Skip to content

fix: audit & dry run — hapus semua dependensi CodeIgniter4, perbaiki 17 bug kritis#5

Merged
mokesano merged 4 commits into
masterfrom
claude/audit-and-dry-run-CRPa8
May 1, 2026
Merged

fix: audit & dry run — hapus semua dependensi CodeIgniter4, perbaiki 17 bug kritis#5
mokesano merged 4 commits into
masterfrom
claude/audit-and-dry-run-CRPa8

Conversation

@mokesano

@mokesano mokesano commented May 1, 2026

Copy link
Copy Markdown
Owner

Ringkasan

Audit menyeluruh terhadap library WizdamDebugToolbar yang ditemukan masih mengandung ~80% dependensi CodeIgniter4 meski diklaim sebagai framework-agnostic. Semua CI4 dependencies dihapus dan 17 bug kritis diperbaiki.

Bug yang Diperbaiki

Collectors

  • Timers: Hapus service("timer", true) → static accumulator start()/stop()/getTimers()/reset()
  • Events: Hapus \CodeIgniter\Events\Events → static trigger(string $event, float $start, float $end)
  • Logs: Hapus service("logger")->logCache → static addLog(string $level, string $msg)
  • Views: Hapus service("renderer") → static logView(string $view, float $start, float $end, array $data)
  • Routes: Hapus service("routes"), service("router"), DefinedRouteCollectorRouterInterface via static registry
  • Database: Tulis ulang penuh — hapus Query class CI4, is_cli(), clean_path(), Time::now(), \Config\DatabaseDatabaseAdapterInterface via static registry
  • Database::reset(): Ubah dari instance method ke static
  • Config: Hapus extends BaseCollector (konflik static method), tambah parameter array $config = []
  • History: Tambah constructor, ganti WRITEPATH dengan $this->historyPath, fix null-check DateTime
  • Files: Ganti clean_path() dengan normalizePath() + isCoreFile()
  • BaseCollector: Ganti cleanPath() CI4 dengan pure PHP

Middleware

  • DebugToolbarMiddleware: Ganti render() (tidak ada) dengan prepare()

Views

  • toolbar.tpl.php: Hapus semua CI4 dependencies
  • Semua _*.tpl: Konversi dari CI4 Parser syntax ke PHP murni

Build

  • phpunit.dist.xml: Ganti bootstrap CI4 dengan vendor/autoload.php

Dry Run (PHPUnit)

Tests: 42, Assertions: 2595, Failures: 0, Errors: 0

claude and others added 2 commits May 1, 2026 14:33
…17 bug kritis

Bug yang diperbaiki:
- DebugToolbarMiddleware::inject() memanggil render() yang tidak ada → gunakan prepare()
- Config::display() menerima 0 arg tapi dipanggil dengan arg → tambah param opsional
- Config extends BaseCollector menyebabkan static method conflict → hapus extends
- History: constructor tanpa param tapi dipanggil new History($config) → tambah constructor
- History::setFiles() menggunakan WRITEPATH (CI4 constant) → gunakan historyPath dari config
- Database.php: seluruh file masih CI4 (Query, config(), is_cli(), \Config\Database, Time) → tulis ulang menggunakan DatabaseAdapterInterface
- Timers.php: service('timer') CI4 → static start()/stop() agnostik
- Events.php: \CodeIgniter\Events\Events → static trigger() agnostik
- Logs.php: service('logger') CI4 → static addLog() agnostik
- Views.php: service('renderer') CI4 → static logView() agnostik
- Files.php: clean_path() CI4 → normalizePath() + isCoreFile() native PHP
- Routes.php: service('routes/router') + DefinedRouteCollector CI4 → RouterInterface
- BaseCollector::cleanPath() memanggil clean_path() CI4 → str_replace native
- toolbar.tpl.php: use CodeIgniter\..., site_url(), $CI_VERSION, $parser → dihapus/diganti
- Semua .tpl: CI4 parser syntax ({key}, {loop}...{/loop}) → plain PHP foreach/if
- phpunit.dist.xml: bootstrap CI4 system/Test/bootstrap.php → vendor/autoload.php
- AdodbDatabaseAdapter::logQuery() tambah parameter $startTime untuk data timeline
- Database::reset() dibuat static agar dapat dipanggil dari tearDown test

Ditambahkan: 3 test file (42 tests, 2595 assertions — semua lulus)

https://claude.ai/code/session_01QevTXiGqzvPkwfj8YeEmB8
@mokesano mokesano marked this pull request as ready for review May 1, 2026 14:47
@mokesano mokesano self-assigned this May 1, 2026
@mokesano mokesano added bug Something isn't working duplicate This issue or pull request already exists enhancement New feature or request labels May 1, 2026
Comment thread src/Collectors/History.php Fixed

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phpcs (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

…ate_from_format

Menghilangkan warning "Avoid using static access to class \DateTime"
dari PHPMD/PHPStan. Hasil DateTime disimpan ke variabel $dt agar tidak
memanggil factory method dua kali.

https://claude.ai/code/session_01QevTXiGqzvPkwfj8YeEmB8
Comment thread src/Collectors/History.php Dismissed
@mokesano mokesano merged commit fcf2238 into master May 1, 2026
13 of 17 checks passed
@mokesano mokesano deleted the claude/audit-and-dry-run-CRPa8 branch May 1, 2026 18:45
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working duplicate This issue or pull request already exists enhancement New feature or request released

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants