Skip to content

Add asset rebuild system and fix code quality issues#20

Merged
ddon merged 2 commits into
BeamLabEU:devfrom
timujinne:dev
Sep 8, 2025
Merged

Add asset rebuild system and fix code quality issues#20
ddon merged 2 commits into
BeamLabEU:devfrom
timujinne:dev

Conversation

@timujinne
Copy link
Copy Markdown
Contributor

Summary

This PR adds a comprehensive asset rebuild system and resolves all static analysis warnings in the PhoenixKit codebase.

🆕 New Features

  • Add comprehensive asset rebuild system with Mix tasks (phoenix_kit.assets.rebuild)
  • Add system status checker (phoenix_kit.status) for installation diagnostics
  • Add asset management tools for automatic CSS integration updates
  • Add helper modules for common functionality and asset detection

🐛 Bug Fixes

  • Fix all Credo warnings (trailing whitespace, formatting, nesting issues)
  • Fix Dialyzer type warnings and add proper function specifications
  • Fix CSS integration logic and @source directive paths
  • Fix complex function refactoring to reduce cyclomatic complexity

🔧 Improvements

  • Simplify CSS integration workflow with better Tailwind CSS 4 support
  • Improve migration progress tracking and user feedback
  • Better code organization with extracted helper functions
  • Enhanced error handling and user notifications

📊 Code Quality

  • All Credo checks pass: found no issues
  • All Dialyzer checks pass: done (passed successfully)
  • Improved code readability and maintainability
  • Better separation of concerns across modules

📁 Files Added

  • lib/mix/tasks/phoenix_kit.assets.rebuild.ex - Asset rebuild task
  • lib/mix/tasks/phoenix_kit.status.ex - System status checker
  • lib/phoenix_kit/install/asset_rebuild.ex - Asset rebuild logic
  • lib/phoenix_kit/install/common.ex - Common utility functions

🧪 Testing

  • All existing tests pass
  • New functionality integrates seamlessly with existing workflows
  • No breaking changes to public APIs

This enhancement provides robust asset management capabilities while maintaining high code quality standards.

- Add comprehensive asset rebuild system with mix tasks
- Add status checking and asset management tools
- Add helper functions for better code organization
- Fix all Credo warnings (trailing whitespace, formatting, nesting)
- Fix Dialyzer type warnings and add proper specs
- Fix CSS integration logic and @source paths
- Update Dialyzer ignore patterns for Mix.Task modules

This resolves static analysis issues while adding robust asset
management capabilities for PhoenixKit installations.
- Fix cond statement to use if in css_integration.ex
- Refactor complex change/3 function in postgres.ex migration
- Extract helper functions to reduce cyclomatic complexity
- Add clear separation of concerns for migration steps
- Maintain same functionality while improving code readability

All Credo and Dialyzer checks now pass successfully.
@ddon ddon merged commit 221f1cd into BeamLabEU:dev Sep 8, 2025
ddon pushed a commit that referenced this pull request May 12, 2026
Code (PR #537 review items addressed):

- #1 BUG-MEDIUM: wrap `Annotations.delete/1` in `Repo.transaction/1` so
  comment-cascade + annotation-delete are atomic. Extracted into
  `delete_in_transaction/1` to keep the body flat (credo depth).
- #2 BUG-MEDIUM: sweep stale `resource_type = "annotation"` claims
  across 3 moduledocs (annotation.ex, v115.ex, etcher_adapter.ex). The
  implementation anchors comments to the file with
  `metadata.annotation_uuid` — docs now match reality.
- #5 BUG-LOW: narrow `delete_linked_comments` rescue to expected
  exception classes ([DBConnection.OwnershipError, Postgrex.Error,
  ArgumentError]) so logic bugs surface instead of being swallowed.
- #11 IMPROVEMENT-LOW: drop `normalize/1` — `Ecto.Changeset.cast/3`
  handles both atom- and string-keyed maps natively; the helper added
  silent failure-mode risk on typo'd keys.
- #12 IMPROVEMENT-LOW: drop in-repo `Code.ensure_loaded?(PhoenixKit.Annotations)`
  guard in MediaBrowser — Annotations is a core module, can't be
  missing.
- #19 NITPICK: drop `PhoenixKit.Modules.Storage` from
  AnnotationComposer's `@compile no_warn_undefined` (it's core, not
  optional — rename should fail loudly).
- #20 NITPICK: simplify `AnnotationComposerPosition.destroyed` guard.
- #21 NITPICK: fix misleading "Etcher's bootstrap uses `||` to preserve
  pre-existing slots" comment — PhoenixKit's JS owns the slots.
- #8 IMPROVEMENT-MEDIUM: gettext-wrap ~17 user-facing strings in
  AnnotationComposer (flash messages + heex literals + ARIA labels).

Credo / dialyzer:
- Alias `PhoenixKit.Annotations`, `PhoenixKit.Modules.Storage`,
  `PhoenixKit.Modules.Storage.EtcherAdapter`, `Storage.File` so the
  six "nested modules could be aliased" findings clear.
- Convert `first_attachment_thumbnail/1`'s single-clause `with` to
  `case` (credo readability).
- Add PhoenixKitComments-targeted entries to .dialyzer_ignore.exs for
  the annotations context + composer (optional sibling package,
  guarded at runtime).
- mix.lock picks up `etcher 0.1.0` via deps.get.

mix precommit: compile → format → credo --strict → dialyzer all clean.
Deferred to original author (Alex): #3 (race), #4 (upload rollback),
#6 (authz), #7 (schema-as-source), #9 (geometry validation), #10
(configurable component id), #13/#14 (locale-aware date + traverse_errors),
plus cosmetics #15-18, #22, #23. Disposition table in CLAUDE_REVIEW.md
updated separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants