Skip to content

refactor(eloquent): SoftDeletes/Scope rename + Model L13 contracts (task 2.5e) - #61

Closed
agissept wants to merge 1 commit into
masterfrom
migration/2.5e-softdeletes-scope-contracts
Closed

agissept wants to merge 1 commit into
masterfrom
migration/2.5e-softdeletes-scope-contracts

Conversation

@agissept

Copy link
Copy Markdown
Member

Slice aman & type-caught dari task 2.5 (Database) — bagian L42x→L13 migration. Bukan pluck/lists swap (itu pipeline 2.5a–d yang terpisah & berbahaya).

Perubahan (fork)

  • SoftDeletingTraitSoftDeletes (+ boot hook bootSoftDeletingTrait()bootSoftDeletes()).
  • ScopeInterfaceScope (SoftDeletingScope + typehint Model di-update).
  • Model implements Illuminate\Contracts\Support\{Arrayable,Jsonable} (dulu Illuminate\Support\Contracts\{ArrayableInterface,JsonableInterface}); 2 instanceof di Model dimigrasikan ke Arrayable.
  • No alias — FQCN lama sengaja fatal, biar app dipaksa conform.

Kenapa aman

  • Boot-hook trap kejaga: bootSoftDeletes harus match basename trait baru, kalau nggak SoftDeletingScope diam-diam berhenti register → row ke-soft-delete bocor. Dibuktikan lewat negative-check: DatabaseEloquentBuilderTest:486 merah kalau nama boot salah, hijau kalau bener.
  • Arrayable swap BC-safe: old ArrayableInterface extends Arrayable (new), jadi instanceof Arrayable strictly lebih lebar — nangkep old+new implementers.

Verifikasi

  • Fork suite hijau: Database 513 tests / 996 assertions, Support+Http+View 199 / 672.
  • php -l semua file bersih.

⚠️ Lockstep

No-alias → begitu fork build ini dipromosikan ke app, app fatal sampai 2.5f (conform: 7 file kode + 3 config alias, SoftDeletingTraitSoftDeletes, ArrayableInterfaceArrayable) landing. Jangan promote build ke app sebelum 2.5f siap.

🤖 Generated with Claude Code

…ace→Scope, Model to L13 contracts (task 2.5e)

Safe, type-caught slice of task 2.5 (Database). No alias — old FQCNs fatal
so the app is forced to conform (task 2.5f, lockstep).

- SoftDeletingTrait → SoftDeletes; boot hook bootSoftDeletingTrait() →
  bootSoftDeletes() (MUST match the new trait basename or Eloquent silently
  stops registering SoftDeletingScope → soft-deleted rows leak). Proven by
  DatabaseEloquentBuilderTest:486 (fails when the hook name is wrong).
- ScopeInterface → Scope; SoftDeletingScope + Model typehints updated.
- Model implements Illuminate\Contracts\Support\{Arrayable,Jsonable} (were
  Illuminate\Support\Contracts\{ArrayableInterface,JsonableInterface}); the 2
  Model instanceof checks migrated to Arrayable. BC-safe: old contracts extend
  the new ones, so instanceof Arrayable is strictly wider.

Does NOT touch lists()/pluck() — that dangerous semantic swap is the separate
2.5a–d pipeline. Fork suites green (Database 513, Support/Http/View 199).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@agissept

Copy link
Copy Markdown
Member Author

Superseded by #64 (pre-release/4.2.96 → master), yang bundle semua task 2.5 (2.5a value + 2.5e SoftDeletes + 2.5d pluck-flip) sebagai satu release PR untuk deploy. Kode sama; ditutup biar nggak dobel-merge. Histori commit tetap ada di git.

@agissept agissept closed this Sep 17, 2026
@agissept
agissept deleted the migration/2.5e-softdeletes-scope-contracts branch September 17, 2026 13:56
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