From b330fbd1a544dcd389972a91ba872f2277ce0f11 Mon Sep 17 00:00:00 2001 From: jamesread Date: Sat, 11 Oct 2025 00:45:41 +0100 Subject: [PATCH] fix: all broken integration tests --- AGENTS.md | 68 + AI.md | 4 +- frontend/index.html | 85 +- frontend/js/marshaller.js | 6 +- frontend/main.js | 5 +- frontend/package-lock.json | 2422 +---------------- frontend/package.json | 17 +- .../gen/olivetin/api/v1/olivetin_pb.d.ts | 12 +- .../gen/olivetin/api/v1/olivetin_pb.js | 4 +- frontend/resources/vue/ActionButton.vue | 2 + frontend/resources/vue/App.vue | 107 +- frontend/resources/vue/Dashboard.vue | 175 +- .../vue/components/DashboardComponent.vue | 41 + frontend/resources/vue/router.js | 19 +- frontend/resources/vue/views/ArgumentForm.vue | 26 +- .../resources/vue/views/ExecutionView.vue | 6 +- frontend/resources/vue/views/LoginView.vue | 214 +- integration-tests/Makefile | 2 +- .../dashboardsWithBasicFieldsets/config.yaml | 10 + .../emptyDashboardsAreHidden/config.yaml | 10 +- integration-tests/lib/elements.js | 28 +- integration-tests/package-lock.json | 629 ++--- integration-tests/package.json | 10 +- .../test/dashboardsWithBasicFieldsets.js | 35 +- .../test/emptyDashboardsAreHidden.js | 13 +- integration-tests/test/entities.js | 22 +- .../entityFilesWithLongIntsUseStandardForm.js | 33 +- integration-tests/test/general.mjs | 66 +- integration-tests/test/hiddenFooter.mjs | 6 +- integration-tests/test/hiddenNav.mjs | 6 +- integration-tests/test/multipleDropdowns.js | 23 +- integration-tests/test/onlyDashboards.mjs | 22 +- integration-tests/test/prometheus.mjs | 3 +- integration-tests/test/sleep.js | 12 +- integration-tests/test/trustedHeader.js | 18 +- proto/olivetin/api/v1/olivetin.proto | 2 + service/gen/olivetin/api/v1/olivetin.pb.go | 24 +- service/internal/api/api.go | 49 +- service/internal/api/apiActions.go | 25 +- service/internal/api/dashboards.go | 63 +- service/internal/entities/templates.go | 17 +- service/internal/executor/executor.go | 1 + service/internal/executor/executor_actions.go | 7 +- .../internal/httpservers/singleFrontend.go | 7 + 44 files changed, 1160 insertions(+), 3196 deletions(-) create mode 100644 AGENTS.md create mode 100644 frontend/resources/vue/components/DashboardComponent.vue diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..a64f036 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,68 @@ +## OliveTin – Agent Guide + +This document helps AI agents contribute effectively to OliveTin. + +If you are looking for OliveTin's AI policy, you can find it in `AI.md`. + +### Project Overview +- **Service (Go)**: `service/` with business logic under `service/internal/*` + - API (Connect RPC): `service/internal/api` + - Command execution: `service/internal/executor` + - HTTP frontends/proxy: `service/internal/httpservers` + - Config/types/entities: `service/internal/config`, `service/internal/entities` +- **Frontend (Vue 3)**: `frontend/` (served by the service) +- **Integration tests**: `integration-tests/` +- **Protos/Generated**: `proto/`, `service/gen/...` + +### How to Run +- Run the server (dev): + - From repo root: `go run ./service` +- Unit tests (Go): + - From repo root: `cd service && make unittests` +- Integration tests (Mocha + Selenium): + - Single test: `cd integration-tests && npx --yes mocha test/general.mjs` + - All tests: `cd integration-tests && npx --yes mocha` + +### Test Notes and Gotchas +- The top-level Makefile does not expose `unittests`; use `cd service && make unittests`. +- Connect RPC API must be mounted correctly; in tests, create the handler via `GetNewHandler(ex)` and serve under `/api/`. +- Frontend “ready” state: the app sets `document.body` attribute `initial-marshal-complete="true"` when loaded. Integration helpers wait for this before selecting elements. +- Modern UI uses Vue components: + - Action buttons are rendered as `.action-button button`. + - Logs and Diagnostics are Vue router links available via `/logs` and `/diagnostics`. + - Some legacy DOM ids (e.g., `contentActions`) no longer exist; prefer class-based selectors. +- Hidden UI features: + - Footer visibility is controlled by `showFooter` from Init API; tests may assert the footer is absent when config disables it. + +### Coding Standards (Go) +- Prefer clear, descriptive names; avoid 1–2 letter identifiers. +- Use early returns and handle edge cases first. +- Do not swallow errors; propagate or log meaningfully. +- Match existing formatting; avoid unrelated reformatting. +- Be safe around nils in executor steps (e.g., guard `req.Binding` and `req.Binding.Action`). + +### API and Execution Flow (High-level) +1. Client calls Connect RPC (e.g., `Init`, `GetDashboard`, `StartAction`). +2. API translates requests to `executor.ExecutionRequest` and calls `Executor.ExecRequest`. +3. Executor runs a chain of steps: request binding → concurrency/rate/ACL checks → arg parsing → exec → post-exec → logging/triggering. +4. Logs are stored and can be fetched via `ExecutionStatus`/`GetLogs`. + +### Common Tasks +- Add/modify actions: update `config.yaml` and ensure `executor.RebuildActionMap()` is called when needed. +- Adjust dashboard rendering: see `service/internal/api/dashboards.go` and `apiActions.go`. +- Frontend behavior: + - Router: `frontend/resources/vue/router.js` + - Main shell/layout: `frontend/resources/vue/App.vue` + - Action button behavior: `frontend/resources/vue/ActionButton.vue` + +### Contributing Checklist +- Review the contributuing guidelines at `CONTRIBUTING.adoc`. +- Review the AI guidance in `AI.md`. +- Review the pull request template at `.github/PULL_REQUEST_TEMPLATE.md`. + +### Troubleshooting +- API tests failing with content-type errors: ensure Connect handler is served under `/api/` and the client targets that base URL. +- Executor panics: check for nil `Binding/Action` and add guards in step functions. +- Integration timeouts: wait for `initial-marshal-complete` and use selectors matching the Vue UI. + + diff --git a/AI.md b/AI.md index ee7589a..2248078 100644 --- a/AI.md +++ b/AI.md @@ -13,9 +13,9 @@ - AI that helps with short tab completion is generally fine. - AI that writes lots of new code across lots of files, or makes lots of superfluous changes is generally less likely to be accepted. - Vibe coding is not a suitable way to contribute to this project. -- [x] Contributors should declare when AI has been used to help write contributions. +- [x] Contributors should declare when AI has been used to help write contributions in the pull request body message. - [x] The project uses AI as an **optional** part of the PR process (coderabbitai). Please raise any concerns about usage within the PR. --- [x] Suggestions from coderabbitai can be accepted verbaitem, but ideally it should be the PR author that uses coderabbitai as a guide, who then re-writes the contribution. + - [x] Suggestions from coderabbitai can be accepted verbaitem, but ideally it should be the PR author that uses coderabbitai as a guide, who then re-writes the contribution. - [x] Maintainers are the only agents permitted to accept merges. ## Development - Build process diff --git a/frontend/index.html b/frontend/index.html index ce47632..55d465c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -21,15 +21,8 @@ - -
- - +