Skip to content

Fix status task and add sitemap lastmod - #427

Merged
ddon merged 4 commits into
BeamLabEU:devfrom
timujinne:dev
Mar 17, 2026
Merged

Fix status task and add sitemap lastmod#427
ddon merged 4 commits into
BeamLabEU:devfrom
timujinne:dev

Conversation

@timujinne

Copy link
Copy Markdown
Contributor

Summary

  • Fix mix phoenix_kit.status showing V01 instead of actual migration version (V84)
  • Add lastmod to sitemap router-discovered and static entries per Google recommendations

Changes

Fix phoenix_kit.status Repo startup

  • phoenix_kit.status task runs with --no-start, but Repo was never properly started
  • status.ex: pass parent app config to repo.start_link/1 instead of empty list
  • postgres.ex: rewrite ensure_repo_started/1 to actually start the Repo process with config from application env, not just check if module is loaded

Add sitemap lastmod

  • Router Discovery: extract actual LiveView module from route.metadata.phoenix_live_view and use its beam file modification time as approximate lastmod
  • Static/Custom entries: use Date.utc_today() as lastmod (generation date)
  • Gracefully returns nil when beam file unavailable (e.g., dev mode in-memory compilation)

Test Plan

  • mix phoenix_kit.status shows correct V84 on Decor3D (path dep)
  • Static source returns ~D[2026-03-17] lastmod via MCP eval
  • Router Discovery beam_file_mtime returns DateTime for compiled modules
  • mix format, mix credo --strict, mix dialyzer pass
  • Pre-commit hooks pass on both commits

Repo was not properly started in --no-start context: status task and
runtime version detection both failed to start the Repo process with
database config, causing all queries to fail silently and fall back to
version 0/1.
Router-discovered pages now use the beam file modification time of the
actual LiveView module (extracted from route metadata) as an approximate
lastmod date. Static and custom entries use the current date of sitemap
generation. In dev mode, parent app modules may lack beam files (in-memory
compilation), so lastmod gracefully falls back to nil.
Extract post update logic into update_post_from_form/3 to bring
cyclomatic complexity from 13 to within the 12 limit.
@ddon
ddon merged commit bdea2e2 into BeamLabEU:dev Mar 17, 2026
6 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.

2 participants