Skip to content

Resolve "[ANMS-UI] Fix broken link to API docs page" - #391

Merged
nick-greenwald merged 30 commits into
mainfrom
387-anms-ui-fix-broken-link-to-api-docs-page
Aug 24, 2026
Merged

nick-greenwald merged 30 commits into
mainfrom
387-anms-ui-fix-broken-link-to-api-docs-page

Conversation

@nick-greenwald

Copy link
Copy Markdown
Contributor

Fixes the broken API docs link in the help page by adding the API docs to the proxy urls in the docker compose file. Chose the Swagger UI /docs as that is what the API docs link pointed to. A /redoc page also exists for the backend with no button to it in the frontend.

Closes #387

@nick-greenwald nick-greenwald self-assigned this Aug 14, 2026
@nick-greenwald
nick-greenwald requested a review from a team as a code owner August 14, 2026 23:53
@nick-greenwald nick-greenwald added the bug Something isn't working label Aug 14, 2026
@nick-greenwald nick-greenwald linked an issue Aug 14, 2026 that may be closed by this pull request
@github-project-automation github-project-automation Bot moved this to Todo in ANMS Aug 14, 2026
Comment thread docker-compose.yml Outdated
nick-greenwald and others added 8 commits August 17, 2026 14:45
Replace FastAPI get_swagger_ui_html/get_redoc_html helpers with custom
HTML that uses fully relative URLs. The FastAPI helpers hardcode
oauth2RedirectUrl as window.location.origin + /docs/oauth2-redirect
which breaks under proxy prefixes like /core/docs.

Changes:
- /docs and /redoc serve directly (200 OK) - no trailing-slash redirects
- Assets use relative paths (../openapi.json, ../release/...) so they
  resolve correctly at any base path
- oauth2RedirectUrl uses window.location.pathname so it stays under
  the proxy prefix
- Removes dead /docs/{path} and /redoc/{path} catch-all routes
Relative "../" paths break when proxy prefix depth changes. Replace
with JS that derives the base from window.location.pathname, so
/docs, /core/docs, or any future prefix all resolve assets correctly.
Comment thread auth/demo/run_proxy.sh
Same approach as Swagger UI: derive base path from window.location.pathname
at runtime instead of static "../" relative URLs, so ReDoc loads correctly
under /core/redoc and any other proxy prefix.
ReDoc requires the <redoc> element to exist before the script loads.
Render it in the body and set spec-url dynamically, matching the Swagger
UI dynamic JS pattern.
CI checkout tests hit /core/docs/ (trailing slash) which returned 307 from
FastAPI auto-redirect. Now both /docs and /docs/ (and /redoc and /redoc/)
return 200 directly. JS regex updated to handle optional trailing slash.
The /search/{query} route handler used the same function name
paged_registered_agents as the root route handler. When FastAPI
generates the OpenAPI schema, both routes share the same operationId,
causing a schema error that breaks /core/docs/ (500) and cascades to
the Angular UI (/) when the backend is unhealthy.

Rename the search route handler to search_registered_agents.
The test entrypoint only checked if authnz responded with any HTTP code,
but authnz starts before upstream backends (anms-core, amp-manager,
anms-ui) are ready. When the proxy can't reach backends, it returns 500.

This was more visible in Podman CI due to slower container startup and
different networking, causing non-deterministic test failures.

Now the readiness check also verifies anms-core responds through authnz
(/core/docs/) and increases the wait timeout from 30s to 90s.
The Containerfile HEALTHCHECK directives are not picked up by docker
compose --wait. Without compose-level healthchecks, --wait considers
services up immediately, causing the checkout test to run before backends
are ready. Podman rootless CI is slower to start, making this more visible.

Add healthchecks with faster intervals (5s) and start_period for
anms-core, anms-ui, and amp-manager. Also change anms-core dependency
on amp-manager from service_started to service_healthy.
postgres had no compose-level healthcheck, so --wait considered it
healthy instantly. Since amp-manager depends on postgres:
service_healthy, it would start before DB was accepting connections,
fail its own healthcheck, and never become healthy. Because anms-core
depends on amp-manager: service_healthy, it never started either.

Result: anms-core and amp-manager containers were missing from
Podman ps output in CI, causing HTTP 500 on /core/docs/ and
/nm/api/agents endpoints.
In Podman rootless, 'localhost' resolves to IPv6 ::1, causing
healthchecks to fail when services only bind to IPv4. Replace
with 127.0.0.1 in both postgres and redis healthcheck definitions.

Also increased postgres retries to 10 and start_period to 15s,
and reduced redis interval/timeout to match other services.
Compose healthchecks never pass inside containers in the
Podman + docker-compose-plugin CI environment, causing --wait
to timeout and blocking service_healthy depends_on.

Remove healthchecks from postgres and redis, change their
depends_on conditions to service_started. Backend services
(anms-core, amp-manager, anms-ui) keep their curl-based
healthchecks. The entrypoint handles final readiness.
Amp-manager crashes on startup when postgres is not yet
accepting connections. Add bash-based TCP socket wait loop
to refdm-proxy CMD so it waits for postgres before starting.

Also remove healthchecks from postgres/redis in compose and
switch depends_on to service_started, since compose healthchecks
never pass inside containers in Podman CI.
postgres has no compose healthcheck but amp-manager, anms-core, and
anms-ui depended on service_healthy, causing Podman to hang forever
waiting for a health status that never arrives.
@BrianSipos

Copy link
Copy Markdown
Collaborator

If there is some way to coerce podman to properly use health checks that will be significantly better than to build many workarounds. Whatever podman needs can be embedded into scripts and the puppet module.

@nick-greenwald

Copy link
Copy Markdown
Contributor Author

@BrianSipos

I was not able to get something to work and did spend many CI cycles trying to. To test locally I think I'd need to replicate everything from setting up Podman rootless CI and pulling all the same images that our GitHub Actions use. I just reverted the changes I made.

@BrianSipos BrianSipos added this to the ANMS v3.0.0 milestone Aug 21, 2026
Comment thread anms-core/anms/routes/ARIs/agents.py Outdated
Comment thread anms-core/anms/asgi/__init__.py
@sonarqubecloud

Copy link
Copy Markdown

@nick-greenwald
nick-greenwald merged commit 3e6cd68 into main Aug 24, 2026
15 checks passed
@nick-greenwald
nick-greenwald deleted the 387-anms-ui-fix-broken-link-to-api-docs-page branch August 24, 2026 20:53
@github-project-automation github-project-automation Bot moved this from Todo to Done in ANMS Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[ANMS UI] Fix broken link to API docs page

3 participants