Skip to content

Commit 730801c

Browse files
committed
Add Copilot instructions for repository setup and usage
1 parent fa7cdb2 commit 730801c

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Copilot Instructions for this Repository
2+
3+
## Prerequisites
4+
5+
- Real-Time Distribution infrastructure must already be configured and running (ADS/ADH with TRCC route active; README states 3.2.1+).
6+
- RCC access is required at the infrastructure layer (TRCC username/password/hosts are configured on ADH side, see `infra_config/rmds_trcc.cnf`), not passed to `trcc_posting.py`.
7+
- Python environment is required for local runs (`console_python/requirements.txt`).
8+
- `websocket-client` support is required for the sample protocol flow (pinned in requirements).
9+
- Jupyter runtime is required only for notebook workflows (`notebook_python/requirements_notebook.txt`).
10+
11+
## Dependency files and expectations
12+
13+
- `console_python/requirements.txt` is the runtime dependency set for the console sample. It pins:
14+
- `websocket-client` (WebSocket connection and callbacks)
15+
- `requests` + `urllib3` + `certifi` + `charset-normalizer` + `idna` (HTTP/TLS stack dependencies)
16+
- `notebook_python/requirements_notebook.txt` is a separate, larger notebook environment lockfile including JupyterLab/Jupyter Server/IPython plus the same networking dependencies used by the console flow.
17+
- Keep console and notebook dependency changes in their respective files; do not merge notebook-only packages into the console requirements.
18+
19+
## Build, run, test, and lint commands
20+
21+
### Console app (primary example)
22+
23+
Run from `console_python`:
24+
25+
```bash
26+
pip install -r requirements.txt
27+
python trcc_posting.py --hostname <ADS_HOST> --port <WS_PORT> --item <CONTRIBUTION_RIC> --service <TRCC_SERVICE>
28+
```
29+
30+
Example values used in this repo are recorded in `run.txt`.
31+
32+
### Docker flow (console app)
33+
34+
Run from `console_python`:
35+
36+
```bash
37+
docker build -t esdk_ws_rcc_python .
38+
docker run esdk_ws_rcc_python --hostname <ADS_HOST> --port <WS_PORT> --item <CONTRIBUTION_RIC> --service <TRCC_SERVICE>
39+
```
40+
41+
### Notebook flow
42+
43+
Run from `notebook_python`:
44+
45+
```bash
46+
pip install -r requirements_notebook.txt
47+
jupyter notebook trcc_posting_notebook.ipynb
48+
```
49+
50+
### Tests and linting
51+
52+
There is no automated test suite or lint configuration in this repository (`pytest`/`unittest`, `ruff`/`flake8`/`pylint` are not configured).
53+
54+
For a single-scenario verification, run one `trcc_posting.py` session against a reachable ADS endpoint and confirm Login Refresh followed by Post Ack output in the console.
55+
56+
## High-level architecture
57+
58+
- `console_python/trcc_posting.py` is the main RCC contribution sample. It is an event-driven `websocket-client` app that:
59+
1. Connects to ADS at `ws://<hostname>:<port>/WebSocket` with subprotocol `tr_json2`.
60+
2. Sends a Login message (`Domain: Login`, `ID: 1`) from `on_open`.
61+
3. On Login Refresh, sends an off-stream OMM Post (`Domain: MarketPrice`, `Type: Post`, `Ack: true`) targeting the contribution item/service.
62+
4. Handles server `Ping` by sending `Pong`.
63+
5. Continues periodic posts (every ~3 seconds) with incremented field values.
64+
- `console_python/market_price.py` is a related consumer/request example (Market Price request after login), useful as a simpler WebSocket reference.
65+
- `infra_config/rmds_trcc.cnf` contains example ADH/TRCC route settings. RCC tunnel credentials and host routing are configured at infra level there, not in the Python app.
66+
- `notebook_python/trcc_posting_notebook.ipynb` mirrors the posting workflow for notebook-based usage.
67+
68+
## Key codebase conventions
69+
70+
- Preserve WebSocket JSON field names/casing exactly as written (`Domain`, `Type`, `Ack`, `PostID`, `PostUserInfo`, etc.) because they map to protocol semantics.
71+
- Login stream identity is intentionally fixed (`login_id = 1`) and reused by post messages (`ID: login_id`) for off-stream posting via the login stream.
72+
- Post construction keeps both top-level `Key` and nested `Message.Key` aligned to the same `item` and `service`.
73+
- `PostUserInfo.UserID` is derived from `app_id` and must be numeric (`int(app_id)`).
74+
- CLI parsing uses `getopt` long options only (`--hostname`, `--port`, `--app_id`, `--user`, `--position`, `--item`, `--service`); keep this style when extending arguments.
75+
- Runtime behavior is based on mutable module-level state (`post_id`, field values, `next_post_time`) rather than class encapsulation; maintain consistency with that pattern unless intentionally refactoring.

0 commit comments

Comments
 (0)