Skip to content

LiveView rewrite#116

Draft
benbot wants to merge 27 commits intomasterfrom
benbot/hatchet
Draft

LiveView rewrite#116
benbot wants to merge 27 commits intomasterfrom
benbot/hatchet

Conversation

@benbot
Copy link
Copy Markdown
Contributor

@benbot benbot commented Apr 19, 2025

Rewriting the frontend in live_view and fixing little things I find along the way.

@benbot benbot changed the title The Hatchet The Hatchet - LiveView rewrite Apr 19, 2025
@benbot benbot changed the title The Hatchet - LiveView rewrite LiveView rewrite Apr 20, 2025
@benbot benbot force-pushed the benbot/hatchet branch 4 times, most recently from a8880aa to c44bfed Compare April 21, 2025 19:09
@lyuma
Copy link
Copy Markdown
Member

lyuma commented Apr 27, 2025

I am not very excited about vendoring the entirety of the UI code from https://github.com/mishka-group/mishka_chelekom - plus, it makes it hard to review. Why can't we include it as a dependency like we do for the rest of the elixir packages.
If we have to make changes to it, perhaps we should fork the mishka_chelekom components and then reference that fork.
Finally, if we do decide to vendor that LiveView addon, we need to add proper attribution and a copy of the Apache 2.0 license to the Uro code so people know where it came from.

Finally, more broadly about the proposal to use LiveView itself...

Depending on the scope and complexity of this change, I would like to suggest we create a new branch. iFire will complain about having multiple branches, but I won't approve merging this to master while we have two half-complete rewrites. A second branch for liveview is the best we can do until the members of the V-Sekai community can agree on what framework to use for the frontend code. I would be happy to deploy this branch to another subdomain of v-sekai.org

Basically, let's try it out in a branch. If this rewrite works well and the overall community prefers LiveView over Next.js, then we can eventually merge it to master. I just don't want to go through the process of pushing unmaintained code to master a second time in one year, so I want to know it will be functional and well-maintained.

@benbot
Copy link
Copy Markdown
Contributor Author

benbot commented Apr 27, 2025

@lyuma its the way the mishka component library is distributed. Its for customizability.

it generates the components (not technically vendoring) and updates them when the cli is run (via sourcery, so it never breaks components)

Idk if we even need Apache attribution in this case as the mishka repo generates these components when run, but it couldn’t hurt.

we don’t need to use mishka (daisyui is also fine. Mishka just has built in support for some live_view features, but nothing that can’t be built by hand) and we don’t need to vendor every component all at once. I just did for this PR.

that being said, all the mishka components are added in a single commit and they’re all in their own directory, so it shouldn’t add any review burden. Just ignore the mishka files as I’ve made no custom changes to them

as far as deployment goes, yes that was my plan.
I was going to have login and the backpack UI built first, then we could evaluate.

if it seems good, I’ll migrate over more of the pages (there doesn’t seem like too much)

then we could decide finally.

regardless there are some important configuration and dockerfile updates in this PR (I’ve talked with @dragonhunt02 about a little bit) that I’ll split out into another if we don’t end up wanting to merge all this in.

@benbot
Copy link
Copy Markdown
Contributor Author

benbot commented Apr 27, 2025

For context: https://mishka.tools/chelekom/docs

You only add what you need to the project, and in the production environment, there will be no trace of the Chelekom library. Instead, all components will be placed in your Phoenix project's components path.

so there’s no production dependencies on mishka either. We don’t distribute any of their code. Just the code their code generates.

I have no intention on dying on the mishka hill, so if you really don’t like it, I’ll just use something else.

@fire
Copy link
Copy Markdown
Member

fire commented Apr 28, 2025

A second branch for liveview is the best we can do until the members of the V-Sekai community can agree on what framework to use for the frontend code. I would be happy to deploy this branch to another subdomain of v-sekai.org

How do we implement this?

@benbot
Copy link
Copy Markdown
Contributor Author

benbot commented Apr 30, 2025

A quick n dirty way would be to add a multi stage dockerfile to main which would pull down this live view branch, build it, and run it. Add that to the docker compose

Then add an entry into the master branch Caddy file to forward requests with the host name beta.v-sekai.org to the new container.

@dragonhunt02
Copy link
Copy Markdown
Contributor

dragonhunt02 commented May 2, 2025

A quick n dirty way would be to add a multi stage dockerfile to main which would pull down this live view branch, build it, and run it. Add that to the docker compose

Then add an entry into the master branch Caddy file to forward requests with the host name beta.v-sekai.org to the new container.

Docker compose and Caddyfile are used for local development.
Production server runs on kubernetes, see configs here https://github.com/V-Sekai/flux-config/tree/flux2/workloads
I don't know how server image build automation is set up though

@benbot benbot force-pushed the benbot/hatchet branch 3 times, most recently from 9e6ea74 to 873efa3 Compare May 14, 2025 20:45
@fire
Copy link
Copy Markdown
Member

fire commented Jan 23, 2026

We discussed a few things yesterday:

  • uro needs a maintainer
    • I stepped up
  • we need to finish this pr for review if we want to merge it into uro main
    • try to reduce generated code and code that is vendored
      • So to remove mishka
        • The login live page would need to be changed to use non-mishka UI components
        • Then the mishka stuff can all be deleted. No more generated code
    • prepare for review vs nextjs
  • Discussed splitting endpoint into endpoint and endpoint_web for the two web servers.
    • 1 endpoint is a rest interface and the second endpoint is the web interface.
    • For isolation we discussed how the web endpoint must use the endpoint either via internal elixir RPC / function call or via a web REST calls
  • Rebase on main
  • Squash to one commit near merge
  • Do quality assurance
    • Generate a list of QA tasks and check stuff still works

fire and others added 5 commits January 28, 2026 15:47
- Convert project to umbrella with apps/uro_api and apps/uro_web
- API app (uro_api): REST endpoint on port 4000, API-only router
- Web app (uro_web): Web endpoint on port 4001 with LiveView support
- Separate supervision trees for process isolation
- Web app depends on API app for accessing contexts via internal calls
- Update all configs for both endpoints
- Move migrations and seeds to API app
- Assets configured for web app only

Co-authored-by: Cursor <cursoragent@cursor.com>
- Remove mvstore setup and namespace creation steps
- Update test_seeds.exs path to apps/uro_api/priv/repo/test_seeds.exs

Co-authored-by: Cursor <cursoragent@cursor.com>
@fire
Copy link
Copy Markdown
Member

fire commented Jan 29, 2026

  • QA List
    • Login on the website
    • Login with the editor
      • Upload avatar
      • Upload world

fire and others added 6 commits January 28, 2026 19:47
- Use Plug.Conn.t() in plug and controller specs (fix unknown_type Conn.t)
- Alias Pow.Plug as PowPlug in EnsureUserNotLockedPlug to fix Plug.Conn resolution
- Add @dialyzer for open_api_operation/1 in FallbackController and IdentityProofController
- Fix File.stream!/3 call in validation (use byte count 4096 as second arg)
- Add @SPEC and @dialyzer for generate_file_sha256/1 and Pow Redis all/2
- Add .dialyzer_ignore.exs for Ecto.Multi call_without_opaque
- Add dialyxir to root mix.exs with paths and ignore_warnings
- .gitignore: apps/*/deps, apps/*/_build, .DS_Store, priv/plts, test_output.txt

Co-authored-by: Cursor <cursoragent@cursor.com>
- Adjust indentation for better clarity in to_json_schema function in User module.
- Add parentheses for logical conditions in UserController to enhance readability and maintainability.
…nversion

Removed root lib/ directory containing duplicate code that was moved to apps/uro_api/lib/uro and apps/uro_web/lib/uro_web during the umbrella conversion.

Removed root priv/repo/ directory containing duplicate migrations and seed files that are now in apps/uro_api/priv/repo/.

Cleaned up root mix.exs by removing elixirc_paths function and ecto aliases that are no longer needed since the root no longer contains application code.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ture

Changed all Application.get_env(:uro, ...) calls and otp_app configurations to use :uro_api instead of :uro to match the umbrella application structure.

Updated config/config.exs to use :uro_api for stale_shard_cutoff and stale_shard_interval configuration keys.

Updated Uro.Repo to use otp_app: :uro_api so Ecto reads repository configuration from the correct application namespace.

Updated Uro.Release to use @app :uro_api for release tasks.

Updated Uro.Mailer to use otp_app: :uro_api and changed all Application.get_env(:uro, Uro.Mailer) and :frontend_url references to :uro_api.

Updated Uro.Gettext and UroWeb.Gettext to use otp_app: :uro_api.

Updated Uro.VSekai.ShardJanitor and Uro.Turnstile to read configuration from :uro_api instead of :uro.

This fixes the 'application :uro is not available' error when running mix test in the umbrella structure.

Co-authored-by: Cursor <cursoragent@cursor.com>
Automate the four QA items from docs/qa-tests.md with API integration tests:
- Login on the website (POST /api/v1/login)
- Login with the editor (POST /api/v1/session)
- Upload avatar (POST /api/v1/dashboard/avatars)
- Upload world (POST /api/v1/dashboard/maps)

Split tests into separate files under test/qa/: website_login_test.exs,
editor_login_test.exs, upload_avatar_test.exs, upload_world_test.exs.
Shared setup (test user with upload permissions) lives in
test/qa/support/qa_case.ex.

Added test fixtures (avatar_data.bin, map_data.bin, preview.jpg) for
multipart upload tests. Updated test_helper.exs to start the uro_api
application so the router and endpoint are available in tests.

Updated docs/qa-tests.md with an Automation section and commands to run
all QA tests or individual test files.

Added Credo as a dev/test dependency in the root mix.exs so mix credo
can be run for static analysis.

Co-authored-by: Cursor <cursoragent@cursor.com>
@fire
Copy link
Copy Markdown
Member

fire commented Jan 29, 2026

IMO, there’s no reason to separate the two into UI and non ui endpoints, especially if you’re using live view, since they will live on different routes already
from benbot.

I did prototype split in the uro pr.

So I need to decide if we need to proceed with two endpoints or revert to the single endpoint design

@fire
Copy link
Copy Markdown
Member

fire commented Feb 4, 2026

Regarding the vendoring problem.

All @lyuma asks is we write a file saying which exact command we ran and which git version of mishka was used so we can reproduce it. We don't need to include the generator if we document which git revision we used and some steps. Doesn't even need to be a script.

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.

4 participants