Skip to content

fix(migrate): cover legacy app migration edge cases - #4

Merged
dxnter merged 3 commits into
mainfrom
fix/migration-compatibility
Apr 27, 2026
Merged

fix(migrate): cover legacy app migration edge cases#4
dxnter merged 3 commits into
mainfrom
fix/migration-compatibility

Conversation

@dxnter

@dxnter dxnter commented Apr 27, 2026

Copy link
Copy Markdown
Member

Summary

Tightens the chassis:migrate flow for a few real-world app shapes found during migration testing.

What changed

  • add UpgradeApiTokenModelStep to upgrade legacy token models to AccessTokenContract
  • support both AccessToken and ApiToken model locations
  • support both expiry styles:
    • expires_at
    • valid_from / valid_to
  • preserve last_ip_used when recording token usage if that column exists
  • fix import insertion for migrated token models so imports are only added to the top-level import block
  • expand UpgradeRebuildDatabaseCommandStep to handle older linear handle() implementations in addition to the canonical $steps array shape
  • generate migrated rebuild commands with an aliased chassis base import via BaseRebuildDatabaseCommand
  • fix ViewServiceProvider cleanup after removing the @datetime directive so empty boot() methods remain valid and cleanly formatted
  • fix stub namespace casing from Sysdev to SysDev for generated subclasses

Why

These fixes came out of validating chassis:migrate against multiple downstream apps with slightly different starter histories. Without them, migrations could produce broken imports, malformed provider output, or miss legacy command and token model shapes.

Impact

Apps migrating to chassis should now get safer output for legacy rebuild commands, legacy token models, and generated subclass stubs without requiring manual cleanup after the migration runs.

Root cause

The migration flow assumed a narrower set of app shapes than what exists in the field:

  • rebuild commands were assumed to use the canonical $steps array structure
  • token models were assumed to match a single starter-era layout
  • string-based cleanup for the old Blade datetime directive left behind malformed empty method bodies in some providers
  • generated subclass stubs still had namespace casing issues in their chassis imports

@github-actions

github-actions Bot commented Apr 27, 2026

Copy link
Copy Markdown

📊 Test Results

    6 files  ±0    186 suites  ±0   13s ⏱️ -2s
  279 tests ±0    279 ✅ ±0  0 💤 ±0  0 ❌ ±0 
1 674 runs  ±0  1 674 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 2de9188. ± Comparison against base commit 74a7a18.

♻️ This comment has been updated with latest results.

@github-actions

Copy link
Copy Markdown

📊 Code Coverage Report

Metric Coverage
Overall Coverage 🟢 100%
Coverage by File
File Coverage
Attributes/AutoSeed.php 🟢 100%
Attributes/AutomaticallyOrdered.php 🟢 100%
Attributes/ValidatesConfig.php 🟢 100%
Console/Commands/AutoSeedListCommand.php 🟢 100%
Console/Commands/RestoreLocalEnvironmentFilesCommand.php 🟢 100%
Console/Commands/WakeDatabaseCommand.php 🟢 100%
Database/ValueObjects/SchemaFileCollection.php 🟢 100%
Database/ValueObjects/SchemaSnapshot.php 🟢 100%
Database/ValueObjects/SnapshotListItem.php 🟢 100%
Enums/ApiRequestFailure.php 🟢 100%
Exceptions/ProblemDetailsRenderer.php 🟢 100%
Exceptions/SentryExceptionHandler.php 🟢 100%
Http/Middleware/AuthenticatesAccessTokens.php 🟢 100%
Http/Middleware/EnsureFeatureEnabled.php 🟢 100%
Http/Middleware/EnvironmentLockdown.php 🟢 100%
Http/Middleware/LogsApiRequests.php 🟢 100%
Http/Responses/ProblemDetails.php 🟢 100%
Models/Concerns/Auditable.php 🟢 100%
Models/Concerns/HasAutomaticOrdering.php 🟢 100%
Models/Scopes/AutomaticallyOrderedScope.php 🟢 100%
Rules/ValidIpOrCidrRule.php 🟢 100%
Seeding/Concerns/AuditsSeederChanges.php 🟢 100%
Seeding/Concerns/CleansUpOrphans.php 🟢 100%
Seeding/Concerns/PerformsIdempotentUpserts.php 🟢 100%
Seeding/IdempotentSeeder.php 🟢 100%
Seeding/IdempotentSeederResolver.php 🟢 100%
Seeding/ValueObjects/SeederInfo.php 🟢 100%
Services/ConfigValidatorResolver.php 🟢 100%
Services/DateTimeFormatter.php 🟢 100%

@dxnter
dxnter marked this pull request as ready for review April 27, 2026 15:40
@dxnter
dxnter merged commit 1271abb into main Apr 27, 2026
11 checks passed
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