# MCSJ AgentV7 — hardened fast deterministic JavaFX operator

## Current status

- Live database target: `chestervillagenydb`
- Hardened agent port: `9807`
- Post-hardening clean restart PID: `8312`
- Legacy listener ports `9797`, `9801`, `9805`, and `9806`: absent after restart
- Current UI after restart: normal MCSJ `Log In` dialog; no credentials were entered by the agent
- Launcher: `python C:/MCSJAgent/mcsj-fast-fx.py ...`
- Agent: `C:/MCSJAgent/SwingBridge/AgentV7.jar`
- Technical source: `C:/MCSJAgent/SwingBridge/src/SwingBridgeAgentV7.java`

## Fast commands

```bash
# Full current-JAB-PID / TCP-owner / ping verification; attaches after restart if needed
python C:/MCSJAgent/mcsj-fast-fx.py ensure

# Cached read-only state/find path
python C:/MCSJAgent/mcsj-fast-fx.py state
python C:/MCSJAgent/mcsj-fast-fx.py find --panel-class <full.class> --class <full.class> ...

# Guarded mutation path; always refreshes authoritative JAB PID first
python C:/MCSJAgent/mcsj-fast-fx.py edit \
  --panel-class util.client.fx.EFXUtadjbatchPanel \
  --class misc.components.fx.EFXTextField --id EFXTextField \
  --text '' --expected '' --new 'VALUE'

python C:/MCSJAgent/mcsj-fast-fx.py cell \
  --panel-class util.client.fx.EFXUtadjbatchPanel \
  --header Descript --row 0 --column 11 --action select --expected ''
```

## AgentV7 fail-closed rules

- Legacy `CLICK`, `SETTEXT`, `FXCLICK`, `FXSETTEXT`, global `FXGETTEXT`, and raw `FXTREE` are disabled in the hardened agent.
- The Python client no longer exposes `click`, `settext`, or `raw` protocol escape hatches.
- The fast launcher allows only `ensure`, `state`, `find`, `edit`, and `cell` plus their exact FX aliases.
- Mutation panel class must be fully qualified, non-wildcard, occurrence zero, and resolve to exactly one outer or nested module anchor.
- Text mutation class must be fully qualified; ID must be exact (empty is allowed); the final target must resolve uniquely.
- Table mutation header must be exact; table occurrence must be zero; exactly one table may match.
- Expected prior text/cell value is mandatory. `*` is rejected server-side and client-side.
- `STALE`, `ERROR`, `REJECTED`, and `NORMALIZED` produce nonzero client exit status.
- Table-cell read errors propagate as errors instead of being treated as empty cells.
- `edit` verifies `TableView.getEditingCell()`; `select` verifies selection/focus; `doubleclick` reports verified event dispatch to the realized target cell.
- JavaFX callbacks use cancellable `FutureTask`. A callback still queued at timeout is cancelled; if already executing, the server waits rather than reporting a false failure while mutation may continue.
- Protocol parse errors are structured JSON.
- Mutation commands perform a fresh JAB PID lookup and compare it to TCP port ownership every time. PID cache is used only for read-only speed paths.

## Regression results

Final AgentV7 suite:

- 12/12 server/protocol tests passed.
- 6/6 Python client tests passed.
- 4/4 live self-healing/hardened-launcher tests passed.
- Java 8 build and Python compilation passed.

Negative tests cover wildcard expected values, wildcard panel scope, ambiguous nested anchors, stale values, disabled legacy mutations, malformed protocol input, raw-command removal, nonzero mutation failures, and wrong command exposure.

## Live reversible proof

Database: `chestervillagenydb`; module: `util.client.fx.EFXUtadjbatchPanel`; draft batch: `AJH59`; account `601-2`.

1. Exact row 0 / `Descript` column 11 `edit` returned `verification=editing-cell-readback`.
2. Unique editor changed empty -> `V7_REVIEW_TEST`, exact read-back succeeded.
3. Editor restored `V7_REVIEW_TEST` -> empty, exact read-back succeeded.
4. Final table row remained account `601-2`, principal `0.00`, description empty.
5. Direct live `FXSETTEXT` returned structured `ERROR` saying the legacy mutation command is disabled.
6. No Save, Update, or Post action was invoked.

## Proof

- `C:/MCSJAgent/proof/agentv7-after-restore-state.json`
- `C:/MCSJAgent/proof/agentv7-after-restore.png`
- `C:/MCSJAgent/SwingBridge/tests/test_agent_v5_live.py`
- `C:/MCSJAgent/SwingBridge/tests/test_client_v5_live.py`
- `C:/MCSJAgent/SwingBridge/tests/test_fast_fx_live.py`
