Skip to content

Fix/bdweb frontend static path - #263

Open
Anurag07-crypto wants to merge 1 commit into
petercorke:feat/bdwebfrom
Anurag07-crypto:fix/bdweb-frontend-static-path
Open

Anurag07-crypto wants to merge 1 commit into
petercorke:feat/bdwebfrom
Anurag07-crypto:fix/bdweb-frontend-static-path

Conversation

@Anurag07-crypto

Copy link
Copy Markdown

Fixes #221

Summary

Corrects the frontend build directory path in src/bdweb/backend/server.py.

Previously, the path used an extra parent-directory traversal, resolving to src/frontend/build instead of the actual src/bdweb/frontend/build directory.

As a result, FastAPI could not locate and mount the built frontend, causing requests to http://localhost:8000/ to return 404 Not Found.

Updated the path to resolve correctly and remain consistent with the frontend path resolution in src/bdweb/backend/__main__.py.

Checklist

  • The issue is assigned to me, and no other open PR already addresses it.
  • This PR covers a single concern.
  • Tests were added or updated, and the full suite passes.
  • The code works on every Python version in the pyproject.toml classifiers (CI tests them all).
  • This change was AI-assisted (tool: ChatGPT), and I have read and run the code myself.
  • This change alters public behaviour: the built frontend can be served from the root URL when the build directory exists.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 6 critical · 11 high · 11 medium · 3 minor

Alerts:
⚠ 31 issues (≤ 0 issues of at least minor severity)

Results:
31 new issues

Category Results
ErrorProne 6 high
Security 3 minor
5 high
6 critical
11 medium

View in Codacy

🟢 Metrics 209 complexity · 6 duplication

Metric Results
Complexity 209
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke

Copy link
Copy Markdown
Owner

Thank you, @Anurag07-crypto, for the reply on #221, and for digging in so quickly. A path bug that makes http://localhost:8000/ return 404 is exactly the kind of thing this issue is meant to turn up.

Two things before this can be reviewed:

1. The base branch. The bdweb editor lives on the feat/bdweb branch and isn't in main yet, so with main as the base this PR shows about 5,000 added lines, the whole of bdweb. The fix itself is a few lines. Please change the base to feat/bdweb (the Edit button next to the PR title has a base branch selector). The diff should then shrink to just your change. If GitHub still lists a lot of unrelated commits afterwards, rebase your branch on feat/bdweb and let me know if you'd like a hand, as this is a common git stumble.

2. How it fits #221. That issue is a test-and-report task: run bdweb end to end from a clean checkout of feat/bdweb and write down what happens, step by step, including anything that goes wrong. The static path bug is a good finding for that write-up. So, as well as the PR, please post what you ran, what you saw (the 404) and what fixed it as a comment on #221. If the write-up is the main deliverable, a small code fix can then go in as its own PR, which keeps each change easy to review.

Your PR checklist also mentions an assigned issue with no other open PR for it, which is fine: #221 is assigned to you.

Thanks again, and welcome to bdsim.

This branch has not been deployed

No deployments
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.

bdweb: run it end to end on a clean checkout and write down what you find

2 participants