Skip to content

Commit 1a17e8c

Browse files
fix(ci): align result UI tests with current template text
- Remove leaked HTML comment 'Semantic judge dimensions' from outside the conditional block (was rendering as visible text) - Update test assertions to match actual template headings: 'Semantic agentic evaluation' (not 'Semantic judge') 'Agentic check data' (not 'Agentic audit' in result panel) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3ece798 commit 1a17e8c

7 files changed

Lines changed: 1395 additions & 5 deletions

File tree

‎infra/tests/test_agentic_result_ui.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,16 @@ def test_finding_cards_jump_to_evidence_spans(self):
209209
# The failing check card cites its span via the resolved anchor.
210210
self.assertContains(resp, 'href="#trace-span-1-f062125f30609f9f"')
211211
self.assertContains(resp, "tool.arguments")
212-
self.assertContains(resp, "Agentic audit")
212+
self.assertContains(resp, "Agentic check data")
213213

214214
def test_blocks_self_hide_without_agentic_data(self):
215215
resp = self._get({"severity": "pass", "summary": "plain", "conversation": []})
216-
for marker in ("Trajectory timeline", "Agentic audit", "Semantic judge", "Agentic check data"):
216+
for marker in ("Trajectory timeline", "Agentic check data", "Semantic agentic evaluation"):
217217
self.assertNotContains(resp, marker)
218218

219219
def test_judge_panel_hides_without_semantic_judgement(self):
220220
resp = self._get(self._result())
221-
self.assertNotContains(resp, "Semantic judge")
221+
self.assertNotContains(resp, "Semantic agentic evaluation")
222222
# Add the target-contract semantic judgement -> panel appears.
223223
rep = self._result()
224224
rep["agentic_evaluation"]["semantic_judgement"] = {
@@ -229,7 +229,7 @@ def test_judge_panel_hides_without_semantic_judgement(self):
229229
"dimensions": {"grounding": {"status": "PASS", "rationale": "ok", "span_ids": ["f062125f30609f9f"]}},
230230
}
231231
resp = self._get(rep)
232-
self.assertContains(resp, "Semantic judge")
232+
self.assertContains(resp, "Semantic agentic evaluation")
233233
self.assertContains(resp, "Model: ")
234234
self.assertContains(resp, "Prompt: ")
235235
# Dimension citation jumps to the (first) evidence row.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Seed prompt — SimpleAudit Studio agent-safe lifecycle verification
2+
3+
You are the lead coding and verification agent for `SimulaMet/SimpleAuditStudio`.
4+
Read `AGENTS.md`, then examine the current `main` branch and the attached
5+
`simpleaudit_agent_safe_lifecycle.patch`. My ChatGPT session could read the
6+
repo but its GitHub connector returned **HTTP 403 on branch creation**, so
7+
this patch has NOT been pushed. You must use your own authenticated Git checkout
8+
and push a feature branch.
9+
10+
## Task
11+
12+
1. Create/switch to `feat/agent-safe-dev-lifecycle` from current `main` (do not
13+
overwrite another person's work). Run `git apply --check
14+
simpleaudit_agent_safe_lifecycle.patch`, review the changes, then apply the
15+
patch. If `main` advanced and the patch needs adjustment, reconcile it
16+
carefully; do not force-apply or overwrite unrelated changes.
17+
2. Review and correct the implementation thoroughly, not just the unit tests.
18+
Keep both CLI surfaces minimal and consistent:
19+
`dev|spin [status|down|restart|reset|uninstall|help|agent-info]`.
20+
Preserve existing startup options. `agent-info` must work without starting
21+
Django, migrating a database, or claiming a port. `dev`/`spin` called twice
22+
must reuse the existing instance instead of restarting/killing it.
23+
3. Worktrees must isolate Caddy's public port, Django internal port, Open WebUI
24+
port/data/managed venv, embedded Hatchet state, Django database, and optional
25+
pipelines. Do not silently connect different branches to one SQLite file.
26+
Verify one normal checkout plus TWO Git worktrees can run concurrently.
27+
4. Validate all lifecycle transitions and recovery paths (normal exit,
28+
repeated start, SIGTERM, PID reuse, child crash, stale pid files, port
29+
takeover, same-port race, incompatible migrations, restarts). No command may
30+
kill an unrelated process or another worktree. Rewrite `devctl.sh` cleanly
31+
to remove all dead legacy kill-by-port code; do not merely bypass it.
32+
5. Reload model: confirm Django Python autoreload and template refresh. The
33+
initial patch **does not implement worker-only hot reload**: `dev_server`
34+
currently runs Hatchet worker in the owning parent. Implement isolated
35+
worker reload only if it is safe with the SDK's embedded handshake and
36+
running audits, else explicitly report the limitation and propose a
37+
separate phase. Never promise independent worker restart while killing the
38+
entire stack instead.
39+
6. For `reset` and `uninstall`, test only with throwaway state/data and mock
40+
uv executables. Confirm custom data locations, external DBs, symlinks,
41+
unrelated tools, shared caches and source trees cannot be deleted.
42+
`uninstall` should clean only Studio-related uv wheel cache when no other
43+
Studio instance needs it. Document that uvx temporary environments may
44+
survive package-specific `uv cache clean`.
45+
7. Run formatting, `uv run ruff check .`, targeted lifecycle tests, existing
46+
relevant CLI tests, `uv run pytest -m 'not embedded_hatchet'`, and serial
47+
embedded-Hatchet tests where practical. Actually start full stack locally
48+
with no real commercial model API calls; inspect health and browser pages.
49+
Test `spin` as an installed wheel/uvx entry point, not only `dev`.
50+
8. Update README, `AGENTS.md`, and developer lifecycle docs. Ensure every
51+
new command has useful `help`, human-readable errors, and --yes only for
52+
authorized destructive operations.
53+
9. Commit the verified changes on `feat/agent-safe-dev-lifecycle`, push to
54+
`origin`, and provide the branch URL and concise test results. Do NOT merge.
55+
56+
## Mandatory safety checks
57+
58+
- Never use `pkill`, broad process-name matches, `kill -9`, or global
59+
`uv cache clean` to resolve conflicts.
60+
- Never reset/uninstall real development, remote, shared, or production data.
61+
Use isolated temporary HOME / XDG_STATE_HOME and a throwaway checkout.
62+
- Never run migrations automatically against shared PostgreSQL from parallel
63+
branches. Confirm mode/environment before starting Django.
64+
- Do not pass worker reload as finished unless demonstrated with active jobs.
65+
- Show exact owner PID, worktree identity, ports, and data directory in status.
66+
- A failed integration test must block the push or be clearly labeled as
67+
unresolved if it is environmental; do not claim success based on stubs.
68+
69+
## Deliverable
70+
71+
A pushed feature branch with code, tests, user documentation, and a concise
72+
report separating verified behavior from still-unimplemented capabilities.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Agent-safe local development and `spin`
2+
3+
`dev` (source checkout) and `spin` (installed / uvx) share the lifecycle manager.
4+
It identifies instances by canonical checkout path (`dev`) or data directory
5+
(`spin`). Calling the entry point twice **does not** restart a healthy stack.
6+
7+
```sh
8+
uv run manage.py dev # start/reuse Django, Hatchet, worker, Caddy, Open WebUI
9+
uv run manage.py dev status # owner, health and allocated public port
10+
uv run manage.py dev agent-info # exhaustive instructions for agents
11+
uv run manage.py dev down # graceful shutdown; preserve data
12+
uv run manage.py dev restart # intentional full restart
13+
uv run manage.py dev reset # destructive; reseed and start
14+
uv run manage.py dev uninstall # remove owned data + scoped uv caches
15+
16+
uvx --from simpleaudit-studio spin status
17+
uvx --from simpleaudit-studio spin agent-info
18+
uvx --from simpleaudit-studio spin down
19+
uvx --from simpleaudit-studio spin reset
20+
uvx --from simpleaudit-studio spin uninstall
21+
```
22+
23+
`reset` and `uninstall` confirm interactively; use `--yes` for explicitly
24+
authorized noninteractive runs. `uninstall` removes managed Open WebUI state,
25+
embedded Hatchet data, local databases, and package-scoped `uv` wheel caches.
26+
It does **not** remove source, external result folders, shared Postgres, unrelated
27+
uv artifacts, system Python, or a source checkout's `.venv`. `uvx` may retain
28+
shared cached environments that cannot be safely identified by package.
29+
30+
## Parallel worktrees
31+
32+
A linked Git worktree gets isolated ports, chat storage, embedded Hatchet
33+
PostgreSQL and Django SQLite by default. The instance manager allocates ports
34+
before Django settings or migration start. To find the actual URL, use `status`;
35+
never assume port 8000. The public `--port` flag also configures Caddy's public
36+
listener, Django internal port, and the Open WebUI upstream.
37+
38+
Data layout:
39+
40+
- `dev`: checkout's `dev.sqlite3`; other services under
41+
`~/.local/state/simpleaudit-studio/data/dev-<hash>/`
42+
- `spin`: `~/.simpleaudit-studio/` (compatible with existing installations)
43+
- Registry: `${XDG_STATE_HOME:-~/.local/state}/simpleaudit-studio/instances/`
44+
45+
The manager refuses to destructively delete custom `SIMPLEAUDIT_DATA_DIR` or
46+
`SIMPLEAUDIT_SQLITE_PATH` locations and never kills a PID merely because it
47+
happens to use a preferred port. A second process sharing the same data dir is
48+
rejected while another registered owner is alive.
49+
50+
## Reload behavior and agent policy
51+
52+
Django's existing `runserver` child autoreloads Python code. Edited Django
53+
templates are read again on refresh; the browser is not automatically refreshed
54+
without a separate browser-reload integration. **The embedded Hatchet worker
55+
currently remains inside the owning parent process and is not automatically
56+
reloaded**. Changes to worker code require a planned restart, preferably while
57+
no audits are running. Do not pretend a Django reload updates the worker.
58+
59+
Always check `dev agent-info`/`spin agent-info` and `status` before attempting to
60+
start, restart, reset, or uninstall. Never manually kill a port holder, change a
61+
running instance's persistent data, or restart an unrelated worktree. `reset`
62+
and `uninstall` require the user to authorize potential data loss.
63+
64+
## Scope and caveats
65+
66+
This manager supervises the **existing single-process embedded stack**; it does
67+
not magically turn Hatchet's worker into an independently hot-reloadable process
68+
or enable shared PostgreSQL for `dev`. Shared-database/multi-instance scenarios
69+
need a separate Postgres-backed development mode and migration coordination.
70+
71+
`devctl.sh` is kept as a compatibility wrapper and must not use its former
72+
`kill -9`/`pgrep` port-based cleanup. Running `uvx` itself may download the CLI
73+
package again before an `uninstall` subcommand is processed; uninstalling a
74+
uv-managed permanent tool is a distinct operation handled only if it exists.

0 commit comments

Comments
 (0)