Files
headroom/NOTICE
trs-80 fe50d96acc chore(dashboard): remove unused vendored htmx (#3469)
## Description

The dashboard has loaded htmx on every page view since the UI's first
commit (`1599821c`, 2026-01-30), and vendored it locally since #2734,
but nothing in the repository has ever used it. Its interaction code is
Alpine plus native `fetch`.

A repository-wide search across all file types — `hx-*`, `data-hx-*`,
`hx_`, `htmx.on/ajax/process/trigger/config/find/swap`, and
`HX-Request`/`HX-Trigger`/`HX-Target`/`HX-Swap` — returns no hit outside
the asset itself. `settings.html` never loaded it, and no packaging file
names it.

This removes the 47,755-byte asset and its references. No replacement
library.

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [x] Code refactoring (no functional changes)

## Changes Made

- Delete `headroom/dashboard/static/htmx.min.js` (47,755 bytes) and its
`<script>` tag in `dashboard.html`.
- Remove the htmx stanza from `NOTICE` and the `htmx.min.js` entry from
the `ASSETS` list in `tests/test_dashboard_static_assets.py` and
`tests/test_dashboard_static_mime_types.py`.
- Update three `tailwind/htmx/alpine` prose comments to
`tailwind/alpine` (`headroom/dashboard/__init__.py`,
`headroom/proxy/server.py`, and the test module docstring).
- Strengthen `test_dashboard_only_references_served_assets`: it checked
one direction only (each `ASSETS` entry appears in the served HTML). It
now asserts set equality both ways — every `/dashboard/static/...`
reference is in `ASSETS`, and every file in `STATIC_DIR` is in `ASSETS`
— so a re-vendored library nobody loads, or a loaded file nobody
vendored, fails the suite. No new test file; the existing test already
owned this contract.

## Testing

- [x] Unit tests pass (`pytest`)
- [x] Linting passes (`ruff check .`)
- [x] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

The strengthened assertion fails against the tree without this change
and passes with it:

### Test Output

```text
$ pytest tests/test_dashboard_static_assets.py -q -k only_references   # asset restored, template tag restored
FAILED tests/test_dashboard_static_assets.py::test_dashboard_only_references_served_assets
1 failed, 8 deselected in 1.82s

$ pytest tests/test_dashboard_static_assets.py tests/test_dashboard_static_mime_types.py \
         tests/test_dashboard_accessibility.py tests/test_dashboard_agent_usage.py \
         tests/test_dashboard_token_savings.py tests/test_cli_dashboard.py \
         tests/test_proxy_dashboard_stats_cache.py \
         tests/test_dashboard_cache_lifetime_playwright.py \
         tests/test_dashboard_cache_net_playwright.py \
         tests/test_dashboard_cache_ttl_playwright.py -q
58 passed, 1 skipped in 13.23s

$ pre-commit run --files NOTICE headroom/dashboard/__init__.py \
      headroom/dashboard/templates/dashboard.html headroom/proxy/server.py \
      tests/test_dashboard_static_assets.py tests/test_dashboard_static_mime_types.py
ruff (legacy alias)......................................................Passed
ruff format..............................................................Passed
mypy.....................................................................Passed
```

`tests/test_dashboard/test_live_feed.py` fails 4 tests here, identically
with and without this change: the harness waits for `#feed-toggle`,
which is not in the template. Pre-existing and unrelated.

## Real Behavior Proof

- Environment: macOS 15.6, Python 3.13.11, Playwright 1.52.0 with
Chromium Headless Shell 136.0.7103.25, branch based on `main` @
`e67b3c8a`.
- Exact command / steps: drove a real browser through the repository's
existing accessibility harness
(`tests/test_dashboard_accessibility._open`, which serves the real
vendored assets from disk) — load `/dashboard`, switch Lifetime then
Session, toggle the theme twice, expand a request row, open the
live-feed drawer and close it with Escape, then wait one 5 s poll cycle
— recording every request, every console warning/error, every page error
and the rendered `<main>` text. Ran identically against the tree with
htmx restored and with it removed, then diffed.
- Observed result: output is identical except the two intended
differences — `GET /dashboard/static/htmx.min.js` is gone (14 requests
to 13, 47,755 fewer bytes per uncached load) and two JavaScript
stack-trace line numbers shift by one, from the deleted `<script>` line.
Same console warnings, same errors, same 2,192 characters of rendered
`<main>`. Every dashboard section still renders, which is the symptom to
watch for here: each lives inside a `<template x-if>` that renders
nothing at all if Alpine fails to load.
- Not tested: no browser latency was measured and none is claimed — the
honest result is one fewer request and 47,755 fewer bytes. Static
analysis cannot prove the absence of runtime htmx use; the evidence is
the repository-wide search plus the byte-identical browser run, not a
proof. Not exercised against a real upstream provider, and not tested on
Windows or in Edge, the environment that motivated vendoring these
assets in #2734.

## Runtime Rollout Safety

- Rollout-managed feature(s): None. The dashboard's static assets are
not rollout-gated.
- Minimum rollout channel: N/A — no rollout-managed feature is touched.
- Stable/default behavior changed: No. The dashboard renders and behaves
identically; one script that was parsed and never used is no longer
sent.
- Kill switch / disable path: N/A — there is no flag to flip. Reverting
the commit restores the asset and the script tag.
- Unsafe override required: No.
- Qualification impact: None. No provider, proxy or optimization path is
touched.
- Rollback path: `git revert` of this commit restores `htmx.min.js`, the
`<script>` tag, the NOTICE stanza and the previous test lists in one
step. No data, schema or config migration is involved.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Screenshots (if applicable)

None. The rendered dashboard is unchanged — verified by comparing the
rendered `<main>` text before and after, not by eye.

## Additional Notes

- Documentation change is the `NOTICE` entry: the vendored-asset
attribution list is the documentation that had to move with this.
- One environment note for anyone reproducing the browser proof: the
dashboard Playwright tests need `python -m playwright install chromium`.
Without it, seven dashboard tests fail before reaching any assertion.
- A separate pre-existing issue found while running the suites:
`tests/test_dashboard_cache_ttl_playwright.py` writes
`dashboard-cache-ttl-main.png` into the repository root on every run, so
it shows as a modified tracked file. Left alone here; it deserves its
own change.
2026-09-11 20:41:51 -07:00

54 lines
1.6 KiB
Plaintext

Headroom
Copyright 2025 Headroom Contributors
This product includes software developed by the Headroom Contributors.
Third-Party Licenses
====================
This software uses the following third-party libraries:
tiktoken
--------
Copyright (c) 2022 OpenAI, Shantanu Jain
Licensed under the MIT License
https://github.com/openai/tiktoken
Pydantic
--------
Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors
Licensed under the MIT License
https://github.com/pydantic/pydantic
sentence-transformers (optional dependency)
-------------------------------------------
Copyright 2019 Nils Reimers
Licensed under the Apache License 2.0
https://github.com/UKPLab/sentence-transformers
Note: Some pretrained sentence-transformer models may have additional licensing
restrictions based on their training data. Please verify model-specific licenses
before commercial use.
FastAPI (optional dependency)
-----------------------------
Copyright (c) 2018 Sebastián Ramírez
Licensed under the MIT License
https://github.com/tiangolo/fastapi
NumPy (optional dependency)
---------------------------
Copyright (c) 2005-2024, NumPy Developers
Licensed under the BSD 3-Clause License
https://github.com/numpy/numpy
Vendored dashboard assets (headroom/dashboard/static/)
------------------------------------------------------
Tailwind CSS 3.4.17 (Play CDN build) — MIT License
Copyright (c) Tailwind Labs, Inc.
https://github.com/tailwindlabs/tailwindcss
Alpine.js 3.13.3 — MIT License
Copyright (c) 2019-2025 Caleb Porzio and contributors
https://github.com/alpinejs/alpine