fix: apply CodeRabbit auto-fixes

This commit is contained in:
ZTatman 2026-11-20 16:56:32 -05:00
parent d192fe8f4d
commit 92a55ef31b
7 changed files with 45 additions and 21 deletions

View file

@ -72,7 +72,7 @@ Open `http://localhost:8000` in your browser. On first boot, Firebreak redirects
- **Forgejo instance URL** — use HTTPS unless Forgejo is a local service or loopback endpoint
- **OAuth credentials** — register an OAuth application in Forgejo first (Settings → Applications → Create OAuth2 Application), then paste the Client ID and Client Secret
- **Public base URL** (optional) — your production domain for OAuth redirects
- **Public base URL** (required) — confirm the pre-filled URL or replace it with the Firebreak URL you want to use for OAuth redirects
### 4. Sign In and Register Your Token

View file

@ -140,11 +140,11 @@ This file is the single source of truth for codebase obstacles, oddities, and th
**Solution/Workaround:** Resolved by migrating the web CSS build to pnpm (`@tailwindcss/cli`), which ships a normally signed binary. If the standalone binary is ever re-downloaded, fix with `xattr -c web/tailwindcss && codesign --force --sign - web/tailwindcss`. Diagnose this class of failure with `/usr/bin/log show --predicate 'eventMessage CONTAINS[c] "tailwind"'`.
**Preference:** Prefer the pnpm-managed CLI; do not re-add the standalone binary.
### Tailwind `--watch` exits when stdin is closed
**Area:** web/package.json (`css:watch` script)
**Obstacle:** Tailwind v4 `--watch` keeps watching only while stdin is open. Under non-interactive shells and some CI contexts stdin closes immediately, so the watcher builds once, exits 0, and silently stops watching. This looks identical to a broken watcher and is easy to misdiagnose.
**Solution/Workaround:** No change needed for normal use — `dev.sh` backgrounds the watcher from an interactive terminal, which inherits an open stdin. If a caller needs watching without a tty, pass `--watch=always`.
**Preference:** Use bare `--watch` for interactive dev; reserve `--watch=always` for headless callers.
### Tailwind watcher can stop on stdin
**Area:** web/dev.sh, web/package.json (`css:watch` script)
**Obstacle:** With job control enabled, the background watcher can stop on SIGTTIN when bare `--watch` reads terminal stdin. With closed stdin it instead exits after the first build.
**Solution/Workaround:** Redirect the background watcher's stdin to `/dev/null` and use `--watch=always`. Keep process-group cleanup in `dev.sh`.
**Preference:** Keep the watcher independent of terminal input. For an isolated smoke check, run the installed CLI against temporary CSS rather than linking the workspace's `node_modules` into a separate pnpm project.
### pnpm install failed with exit 1 on blocked build scripts
**Area:** pnpm-workspace.yaml
@ -265,3 +265,9 @@ This file is the single source of truth for codebase obstacles, oddities, and th
**Obstacle:** Non-JSON responses or invalid JSON shapes raised outside the dashboard/picker's HTTP error boundary. Pydantic v2 also lets a validator's `TypeError` escape validation.
**Solution/Workaround:** Validate expected JSON shapes in the client, use `ValueError` for field validation, and return a sanitized 502 for malformed data.
**Preference:** Keep the dashboard and picker usable without displaying upstream response content.
### Failed picker requests can reveal stale selections
**Area:** web/app/templates/dashboard.html, web/app/templates/snapshot_picker.html
**Obstacle:** HTMX clears its loading indicator after a failed request without replacing the old branch or commit controls.
**Solution/Workaround:** Mark the dependent fragment `inert` before sending a request and replace its outer element only when a response swaps. Show an inline error if the old fragment remains after loading.
**Preference:** Don't allow a stale selection to submit; preserve the dialog's layout during loading and failure.

View file

@ -534,16 +534,23 @@
align-content: start;
}
.picker-load-scope > :is(.picker-loading, .picker-loaded) {
.picker-load-scope > :is(.picker-loading, .picker-loaded, .picker-load-failed) {
grid-area: 1 / 1;
}
.picker-loading,
.picker-load-failed,
.picker-loaded[inert],
.picker-load-scope.htmx-request > .picker-loaded {
visibility: hidden;
}
.picker-load-scope.htmx-request > .picker-loading {
.picker-loaded[inert] {
opacity: 0;
}
.picker-load-scope.htmx-request > .picker-loading,
.picker-load-scope:not(.htmx-request):has(> .picker-loaded[inert]) > .picker-load-failed {
visibility: visible;
}

View file

@ -61,6 +61,11 @@
</div>
</div>
</dialog>
<script>
document.getElementById("snapshot-picker").addEventListener("htmx:beforeRequest", ({ detail: { target } }) => {
if (target.matches("#snapshot-branch-content, #snapshot-commit-content")) target.inert = true;
});
</script>
{% endif %}
<section class="grid gap-4 md:grid-cols-3">
<div class="p-4 card">

View file

@ -13,7 +13,7 @@
hx-get="{{ url_for('get_snapshot_picker_step', step='branch').path }}"
hx-trigger="change"
hx-target="#snapshot-branch-content"
hx-swap="innerHTML"
hx-swap="outerHTML"
hx-indicator="#snapshot-branch-scope"
hx-sync="#snapshot-picker:replace">
<button type="button"><selectedcontent></selectedcontent></button>
@ -25,8 +25,11 @@
</div>
<div id="snapshot-branch-scope" class="picker-load-scope">
<p class="picker-status picker-loading" role="status">Loading branches…</p>
<div id="snapshot-branch-content" class="picker-loaded">
{% block branch_steps %}
<p class="picker-status picker-load-failed" role="status" data-state="error">
Could not load branches. Choose a repository again or reopen the picker.
</p>
{% block branch_steps %}
<div id="snapshot-branch-content" class="picker-loaded">
<div class="picker-step">
<span class="picker-step-index" aria-hidden="true">2</span>
<div>
@ -40,7 +43,7 @@
hx-trigger="change"
hx-include="#snapshot-repository"
hx-target="#snapshot-commit-content"
hx-swap="innerHTML"
hx-swap="outerHTML"
hx-indicator="#snapshot-commit-scope"
hx-sync="#snapshot-picker:replace">
<button type="button"><selectedcontent></selectedcontent></button>
@ -60,7 +63,7 @@
hx-get="{{ url_for('get_snapshot_picker_step', step='branch').path }}"
hx-include="#snapshot-repository"
hx-target="#snapshot-branch-content"
hx-swap="innerHTML"
hx-swap="outerHTML"
hx-indicator="#snapshot-branch-scope"
hx-sync="#snapshot-picker:replace">Retry</button>
{% endif %}
@ -72,8 +75,11 @@
</div>
<div id="snapshot-commit-scope" class="picker-load-scope">
<p class="picker-status picker-loading" role="status">Loading commits…</p>
<div id="snapshot-commit-content" class="picker-loaded">
{% block commit_step %}
<p class="picker-status picker-load-failed" role="status" data-state="error">
Could not load commits. Choose a branch again or reopen the picker.
</p>
{% block commit_step %}
<div id="snapshot-commit-content" class="picker-loaded">
<div class="picker-step">
<span class="picker-step-index" aria-hidden="true">3</span>
<div>
@ -115,11 +121,11 @@
{% endif %}
</div>
</div>
{% endblock %}
</div>
</div>
{% endblock %}
</div>
{% endblock %}
</div>
</div>
{% endblock %}
</div>
{% endblock %}
<!-- djlint:on -->

View file

@ -19,7 +19,7 @@ echo " PostgreSQL / db / firebreak / firebreak / firebreak_db"
echo " CSS: watching app/static/css/input.css"
set -m
pnpm run css:watch &
pnpm run css:watch </dev/null &
TW_PID=$!
set +m

View file

@ -4,7 +4,7 @@
"version": "0.1.0",
"scripts": {
"css": "tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css",
"css:watch": "tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css --watch"
"css:watch": "tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css --watch=always"
},
"devDependencies": {
"@tailwindcss/cli": "4.3.0"