Commit 21f324a7 authored by Vacaliuc, Bogdan's avatar Vacaliuc, Bogdan
Browse files

CLAUDE.md: note new direct-archiver-query capability for S3 gap work



setup/archiver-query (committed to main 2026-04-11) reads the SNS CSS
archiver Oracle database directly. For the S3 gap tolerance-budget
investigation this means the assistant can autonomously fetch any of:
  Gap.RBV, Gap, RSlit3.RBV, LSlit3.RBV
across any historical window without needing operator CSV exports.

Documents the S3-specific query patterns: always include L/R blade RBVs
alongside Gap.RBV (since Gap is a virtual readback computed from both),
how to compute deviations from target via jq, how to filter for marker /
out-of-range anomalies across a 30-day window in one query.

Co-Authored-By: default avatarClaude Opus 4.6 (1M context) <noreply@anthropic.com>
parent e5824b68
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -22,6 +22,52 @@ There are many files that have been collected during the investigation of the fa
* /SNS/users/6ov/BL4A/2026/03/26/
* /SNS/users/6ov/BL4A/2026/03/28/

## Direct archiver query (use this for time-series correlations)

The `setup/archiver-query` tool on `main` (committed 2026-04-11) reads the
SNS CSS archiver Oracle database directly — no operator CSV export round-trip
needed. For this S3-gap investigation, that means the assistant can
autonomously fetch:

```bash
# All four S3 layer PVs at once during a known failure window
./setup/archiver-query.sh \
    --pv 'BL4A:Mot:S3:X:Gap.RBV,BL4A:Mot:S3:X:Gap,BL4A:Mot:S3:X:RSlit3.RBV,BL4A:Mot:S3:X:LSlit3.RBV' \
    --start '2026-03-28 23:48:00' --end '2026-03-28 23:53:00' \
    --format csv -o /tmp/s3-gap.csv

# Or as JSONL with status flags surfaced
./setup/archiver-query.sh \
    --pv 'BL4A:Mot:S3:X:Gap.RBV' \
    --start '2026-03-28 23:48:00' --end '2026-03-28 23:53:00'

# Or check S3 history over a 30-day window for tolerance-budget violations
./setup/archiver-query.sh \
    --pv 'BL4A:Mot:S3:X:Gap.RBV' \
    --start '2026-03-01 00:00:00' --end '2026-03-31 00:00:00' \
    | jq -c 'select(.is_marker or .out_of_range)'
```

For S3-Gap tolerance-budget work specifically:
- The **virtual slit motor's RBV is computed** from LSlit3.RBV and RSlit3.RBV.
  Querying just `Gap.RBV` from the archiver gives you the virtual readback
  CSS would have used for its scan-server tolerance check, **not** what the
  physical motors did. Always include the L/R blade RBVs alongside Gap.RBV.
- **Gap-vs-target deltas during a failure** can be computed in JSONL with
  one `jq` invocation:
  `jq -c '. + {dev: (.value - 4.143068)}'` where 4.143068 is the target.
- **`is_marker=true`** flags Disconnected windows where the gap readback is
  meaningless (Galil reset, IOC restart, etc.).
- Use `--describe-channel BL4A:Mot:S3:X:Gap.RBV` to discover the channel's
  `num_metadata.[low_disp_rng, high_disp_rng]` so you know when to expect
  `out_of_range=true`.

Verified end-to-end against the operator-exported DANGLE incident CSV
(byte-for-byte match for all 128 data rows). Same query path applies to S3.

Full docs: `setup/docs/sns-archiver-query.md` on `main`.
Plan: `plan/archiver-query-tool.md` on `main`.

## Secure Temporary Files

When a task requires writing a temporary script or data file (e.g. to work around