fix: detect Mercury stage per-view via session name
The Mercury app (3.2.x) is a hybrid server whose kernel pool serves both the client-facing app view and JupyterLab, so the server-level MERCURY_CONFIG_DIR signal cannot tell who is looking and leaks backstage content in the app. Switch the primary stage signal to the shadow-copy session name (__mercury__ in JPY_SESSION_NAME), keeping the env var only as a --working-dir fallback. - Update CX Discovery staging.py to the per-view detection model - Ignore Mercury runtime artifacts (.mercury_sessions/, *__mercury__*) - Document the leak in remaining masters (TEI, CTM, AI Diagnostic, template) and flag the staging.py retrofit as urgent
This commit is contained in:
18
CLAUDE.md
18
CLAUDE.md
@@ -78,9 +78,11 @@ there; the repo-root `.venv` (from `make setup`) serves only `core/` and the not
|
||||
structural suite. Running a master's pytest from the wrong venv is the classic
|
||||
"missing module" ghost.
|
||||
|
||||
- `MERCURY_CONFIG_DIR` present in the environment = **the stage is live** (a client
|
||||
may be looking). Its presence is the stage signal `staging.py` keys off — never set
|
||||
it manually except to simulate the stage in a test.
|
||||
- Stage detection is **per view, not per server**: the primary signal is
|
||||
`__mercury__` in `JPY_SESSION_NAME` (the app's shadow-copy session);
|
||||
`MERCURY_CONFIG_DIR` is only a fallback and is set **only** by
|
||||
`mercury --working-dir`. Never set either manually except to simulate the stage
|
||||
in a test (Mercury pattern §6 has the mechanism).
|
||||
- Only masters live here. **If a notebook in this repo contains a real client's name,
|
||||
something is wrong** — stop and flag it (see Confidentiality).
|
||||
|
||||
@@ -219,6 +221,12 @@ quietly leaving it. Live ones worth knowing:
|
||||
fix the typing with the redesign, not piecemeal.
|
||||
- **TEI twins + CTM pre-date the tagged-cell taxonomy** — the structural suite
|
||||
grandfathers them by name in `tests/nbcheck.py`, each with its reason.
|
||||
- **Every master except CX Discovery still carries the env-var-only `staging.py`**
|
||||
(TEI twins, CTM, AI Diagnostic, template) — their `on_stage()` misses the Mercury
|
||||
app unless the server was launched with `--working-dir`, so **their stages leak
|
||||
backstage content** on a plain `mercury` launch (found live 2026-07-31; fixed in
|
||||
the Discovery reference). The retrofit is a recorded opportunity — until it
|
||||
lands, serve those masters only via `mercury --working-dir .`.
|
||||
- **`template/MercuryNotebook/` encodes only the py-engine model** (and its
|
||||
`staging.py` lacks the mypy-strict `backstage_md` variant); rework is a recorded
|
||||
follow-up. Its `exports/*.{html,md}` are tracked — predates the exports rule.
|
||||
@@ -237,7 +245,9 @@ quietly leaving it. Live ones worth knowing:
|
||||
- TEI + AI Diagnostic redesigns to the notebook-first model (each moves its notebook
|
||||
from GRANDFATHERED to NOTEBOOK_FIRST in `tests/nbcheck.py`).
|
||||
- Template rework: an Assessment template derived from the Discovery reference;
|
||||
staging.py mypy-strict retrofit across masters.
|
||||
staging.py retrofit across masters (now urgent-ish: brings the corrected
|
||||
shadow-session stage detection, plus mypy-strict + `backstage_md`, to the TEI
|
||||
twins, CTM, AI Diagnostic, and the template).
|
||||
|
||||
## Reference
|
||||
|
||||
|
||||
Reference in New Issue
Block a user