refactor(diagnose): trim instrumentation-r.md to the 100-line cap

- Drop the tag-emphasis sentence from the Logging section (duplicates
  the dedicated tag-convention section below)
- Drop generic tar_option_set advice (not instrumentation)
- Drop the "single date/single tag/one regex" restatement
- Compress the smuggle-a-fix and .Rprofile anti-patterns to one line each
This commit is contained in:
Łukasz Boryń 2026-06-18 23:41:33 +02:00
parent 22951e5b79
commit 4aebdee30a

View File

@ -59,8 +59,6 @@ workers, a long bookdown render), `cat()` *with the diagnose tag*:
cat(sprintf("### DIAGNOSE-2026-05-28 assemble_expr: nrow=%d md5=%s\n", cat(sprintf("### DIAGNOSE-2026-05-28 assemble_expr: nrow=%d md5=%s\n",
nrow(df), digest::digest(df))) nrow(df), digest::digest(df)))
``` ```
The tag matters. Cleanup is `grep -r "### DIAGNOSE-" .` followed by
manual review — no tag, no cleanup.
## Performance bugs ## Performance bugs
@ -89,20 +87,14 @@ After a target fails, inspect upstream inputs without re-running them:
targets::tar_load_everything() targets::tar_load_everything()
browser() ### DIAGNOSE-2026-05-28 browser() ### DIAGNOSE-2026-05-28
``` ```
For long-running pipelines, set `tar_option_set(error = "continue")` so
one bad target doesn't hide later ones from view.
## The `### DIAGNOSE-<date>` tag convention ## The `### DIAGNOSE-<date>` tag convention
- **Every** line you add for diagnosis carries `### DIAGNOSE-YYYY-MM-DD`. - **Every** line you add for diagnosis carries `### DIAGNOSE-YYYY-MM-DD`.
- Single date format. Single tag. One regex finds them all.
- Phase 6 ends only when `grep -r "### DIAGNOSE-" .` returns zero hits. - Phase 6 ends only when `grep -r "### DIAGNOSE-" .` returns zero hits.
## Anti-patterns ## Anti-patterns
- **Adding `print()`s without a tag.** They survive into commits. - **Adding `print()`s without a tag.** They survive into commits.
- **Multiple hypotheses instrumented at once.** Loses the signal. - **Multiple hypotheses instrumented at once.** Loses the signal.
- **Editing the function under test to "make it work"** while still - **Smuggling a fix into instrumentation.** Separate the two phases.
collecting evidence. That's a fix smuggled into instrumentation — - **Leaving `options(error = recover)` in `.Rprofile`** — devastating in CI.
separate the two phases.
- **Leaving `options(error = recover)` in `.Rprofile`.** Devastating in
scripts and CI.