Skip to content

Commit 9c42b3d

Browse files
Fix contract rules.
1 parent 7a57791 commit 9c42b3d

4 files changed

Lines changed: 40 additions & 2 deletions

File tree

monitor/cursor-rules/implementation-workflow-discipline.mdc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Use these during **plan**, **implement**, **self-review**, and **verification**
2222
| [monitor-collect-tier-gating.mdc](monitor-collect-tier-gating.mdc) | Two-tier collect/emit: `stats_set` gate, daemon phase, SIGHUP slot reset. |
2323
| [monitor-schema-keys-headers.mdc](monitor-schema-keys-headers.mdc) | Shared `KEYS` headers; contract tests include headers, no macro duplication. |
2424
| [monitor-consumer-schema-migration.mdc](monitor-consumer-schema-migration.mdc) | Breaking output: rename map, README rollout, contract tests. |
25+
| [monitor-consumer-side-plan.mdc](monitor-consumer-side-plan.mdc) | Monitor changes needing consumer work: secondary plan (what + why) before/during implement. |
2526
| [monitor-debug-shm.mdc](monitor-debug-shm.mdc) | DEBUG `/dev/shm` mirror: permissions, gating, tests. |
2627
| [monitor-ib-sysfs-parsing.mdc](monitor-ib-sysfs-parsing.mdc) | IB port state parsers; inactive/active substring traps. |
2728
| [monitor-ci-workflow.mdc](monitor-ci-workflow.mdc) | GitHub `monitor-verify.yaml` vs local dual-verify. |
@@ -45,6 +46,8 @@ Break the problem down step-by-step. In the response (or in thinking for trivial
4546

4647
Only after this breakdown, implement. Skip the written plan only for truly trivial edits (typo, comment-only) where the change is obvious and risk-free.
4748

49+
If the monitor plan implies consumer changes, add the **Consumer follow-up plan** section per **monitor-consumer-side-plan** (even when implementing monitor-only in this session).
50+
4851
## 3. Implement
4952

5053
Write the code. Match existing conventions in the touched files and the **Related rules** above — at minimum [monitor-c-conventions.mdc](monitor-c-conventions.mdc) for monitor C, [traceback-fix-discipline.mdc](traceback-fix-discipline.mdc) for error-driven fixes, and [monitor-workspace-contract.mdc](monitor-workspace-contract.mdc) for scope and consumer contracts.

monitor/cursor-rules/monitor-consumer-schema-migration.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Any change that breaks **historical** ingest or queries:
2626
- `removed_legacy:` for retired typenames/keys
2727
2. **`monitor/README.md`** — migration table or rollout note (deploy monitor + consumer together when needed).
2828
3. **Contract tests** — `test_*_schema_contract.c` or golden tests for new shape.
29-
4. Call out if **`listend.py`** / **`sync_timedb_parsing.py`** need a separate authorized consumer edit (**monitor-workspace-contract**).
29+
4. **Consumer secondary plan** — structured what/why/rollout/verify section per **monitor-consumer-side-plan** (implementation still requires explicit user authorization).
3030

3131
## Two-tier rollout
3232

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
description: When monitor output changes need consumer work, produce a secondary consumer plan (what + why)
3+
alwaysApply: true
4+
---
5+
6+
# Monitor: consumer-side secondary plan
7+
8+
When a **monitor** change would require updates outside `HPCPerfStats/monitor/` (ingest, dbload, analysis, dashboards), produce a **secondary consumer plan** in the same turn — **before** or **alongside** monitor implementation. Do **not** implement consumer code unless the user explicitly authorizes that path (**monitor-workspace-contract**, **out-of-monitor-hpcperfstats-rules**).
9+
10+
## Trigger (any of these)
11+
12+
- New or changed sample/schema shape (`@fast`/`@full`, `,R=S`, column count, host token position).
13+
- `st_name`, device id, or event key rename/retirement that breaks historical ingest or queries.
14+
- Semantics change (gauge vs cumulative `E`, MAD vs sysfs counter source).
15+
- Consumer parser would mis-align, drop, or mis-label columns without a matching change.
16+
17+
Read **`HPCPerfStats/hpcperfstats/listend.py`** (and relevant parsers such as **`sync_timedb_parsing.py`**) to confirm impact — do not guess.
18+
19+
## Required secondary plan content
20+
21+
Use a clearly labeled section, e.g. **Consumer follow-up plan**, with:
22+
23+
1. **Why** — what monitor behavior changed and why the current consumer cannot handle it.
24+
2. **What** — concrete tasks (files/functions/tests) on the consumer side.
25+
3. **Rollout** — deploy order (consumer first vs together vs monitor escape hatch e.g. `enable_slow_tier 0`).
26+
4. **Verification** — consumer tests or manual checks to run after both sides land.
27+
5. **Rename/migration** — YAML map entries, dashboard/query updates if applicable (**monitor-consumer-schema-migration**).
28+
29+
Keep the plan actionable for a separate session or authorized consumer edit; it is not a substitute for **`monitor_variable_rename_map.yaml`** or **`monitor/README.md`** migration notes when those apply.
30+
31+
## Monitor-only handoff
32+
33+
In the monitor implementation summary, state explicitly: **consumer plan attached** or **no consumer changes required**, with one sentence of rationale.
34+
35+
Cross-links: **monitor-workspace-contract**, **monitor-consumer-schema-migration**, **implementation-workflow-discipline**.

monitor/cursor-rules/monitor-workspace-contract.mdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ alwaysApply: true
3030
## Change Validation Expectation
3131

3232
- For monitor-side message format changes, validate compatibility against `listend.py` parsing logic before finalizing edits.
33-
- If a monitor change would require consumer changes, stop and call out the contract break clearly.
33+
- If a monitor change would require consumer changes, produce a **secondary consumer plan** (what + why) per **monitor-consumer-side-plan** — do not only mention a vague “contract break.”
3434

3535
## Precedence and overrides
3636

0 commit comments

Comments
 (0)