Skip to content

Reduce per-framework coupling in internal/conventions/ and tests/ - #120

Merged
ddtcorex merged 1 commit into
masterfrom
feature/framework-isolation-conventions-tests
Aug 7, 2026
Merged

Reduce per-framework coupling in internal/conventions/ and tests/#120
ddtcorex merged 1 commit into
masterfrom
feature/framework-isolation-conventions-tests

Conversation

@ddtcorex

@ddtcorex ddtcorex commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Moves framework-exclusive constants (Default<Framework>DBUser/Pass/Name, a few tool-binary paths) out of the shared internal/conventions/ package into each owning framework's own package, verified single-consumer via grep before each move. Genuinely shared constants (Magento1/Magento2/MageOS DB defaults, admin credentials, paths, permissions) stay in conventions.
  • Deletes internal/conventions/frameworks.go (14 FrameworkXxx constants, all with zero real consumers) plus two other dead constants (BinWpCli, UserMagento).
  • Reorganizes tests/: single-framework test functions move out of shared grab-bag files (bootstrap_frameworks_test.go, bootstrap_staged_frameworks_test.go, framework_defaults_test.go, framework_detection_test.go) into that framework's own <subject>_<framework>_test.go. Functions that genuinely compare ≥2 frameworks are rewritten table-driven with framework-generic names instead.
  • Fixes Drupal's bootstrap to use the shared conventions.DefaultAdminUser/Password/Email convention instead of hardcoded admin/admin/admin@local.test — the one intentional behavior change in this PR. Existing Drupal sites are unaffected (the password lives in their database, not in this code path); newly-bootstrapped ones get the standard Admin12345678$ password instead of admin.

Closes #119

Test plan

  • go build ./..., go vet ./..., gofmt -s -l . clean
  • go test ./... and make test (lint + fmt-check + vet + Go tests + frontend tests + integration tests) pass
  • Every moved test function verified byte-for-byte identical to its pre-move body (no transcription drift)
  • Test-count reconciliation: only the two deliberate consolidations (4 detection-priority tests → 1 table-driven; 1 Dagster-specific snapshot test folded into an existing generic loop) account for the net function-count change — no accidental coverage loss
  • Zero repo-wide stale references to any moved/deleted constant (grepped across all file types, not just .go)
  • Independent final whole-branch review (traced Task 1's Postgres-fallback reachability, Task 18's shell-quoting safety, and Task 16's coverage-fold equivalence) — 2 Important findings fixed in this branch (stale doc comment, two framework lists missing dagster/django); 5 Minor findings deferred to a follow-up cleanup issue (naming-collision risk between local and shared DefaultDBUser/Pass/Name-shaped constants, a couple of now-tautological tests, minor import-group style drift, pre-existing dual test-file naming convention)

…tests/

Implementing the Dagster framework surfaced two shared-file coupling
points that every framework addition touches, even when the touched
content is framework-exclusive:

- internal/conventions/ grew by 3-4 constants per framework
  (Default<Framework>DBUser/Pass/Name), even though most were only
  ever read by that one framework's own package.
- tests/ mixed framework-specific test functions into shared grab-bag
  files (bootstrap_frameworks_test.go, bootstrap_staged_frameworks_test.go,
  framework_defaults_test.go, framework_snapshot_test.go,
  framework_detection_test.go), so adding a framework meant editing
  files that also contained unrelated frameworks' tests.

Part A: move framework-exclusive constants (DB credential defaults,
a few tool-binary paths) out of internal/conventions/ into the owning
framework's own package, verified single-consumer via grep before each
move. Genuinely shared constants (Magento1/Magento2/MageOS DB defaults,
admin credentials, paths, permissions) stay in conventions. Delete
internal/conventions/frameworks.go (14 FrameworkXxx constants with zero
real consumers) plus two other dead constants (BinWpCli, UserMagento).
Decouple internal/cmd/db_credentials.go's Postgres-engine fallback from
Django's constants by introducing generic DefaultPostgresDBUser/Name.

Part B: reorganize tests/ so a test function exercising exactly one
framework lives in that framework's own <subject>_<framework>_test.go
file; functions that genuinely compare >=2 frameworks are rewritten as
table-driven tests with framework-generic names instead of living in a
shared grab-bag file under a misleadingly specific name. Fold Dagster's
dedicated CA-mount/linked-hosts render test into the existing generic
non-PHP-frameworks loop, closing a duplicate-coverage gap.

Part C: fix Drupal's bootstrap to use the shared
conventions.DefaultAdminUser/Password/Email convention instead of
hardcoded admin/admin/admin@local.test - the one intentional behavior
change here. Existing Drupal sites are unaffected (the password lives
in their database, not in this code path); newly-bootstrapped ones get
the standard Admin12345678$ password instead of admin.

Adding a new framework no longer requires editing internal/conventions/
at all. Every moved test function was verified byte-for-byte identical
to its pre-move body; test-count reconciliation confirms the only
function-count changes are the two deliberate consolidations described
above, with zero accidental coverage loss.

Closes #119

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ddtcorex
ddtcorex force-pushed the feature/framework-isolation-conventions-tests branch from 7b9051a to 7cf226f Compare August 7, 2026 07:02
@ddtcorex
ddtcorex merged commit 34741b0 into master Aug 7, 2026
7 checks passed
@ddtcorex
ddtcorex deleted the feature/framework-isolation-conventions-tests branch August 7, 2026 07:11
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.

Reduce per-framework coupling in internal/conventions/ and tests/

1 participant