Skip to content

Commit acca4e8

Browse files
terchrisclaude
andcommitted
docs: new investigations from ollacrm's onboarding + feedback issues, add usage-conventions page
Two new investigations: a real broken command found in ollacrm's own onboarding run (NODE_OPTIONS doesn't support --env-file), and a triage of GitHub issues #26/#27 (production feedback + real usage conventions), including a root-cause fix design for the auto-instrumentation import-order footgun. Also adds using/onboarding/ollacrm/conventions.md, turning ollacrm's real production logging conventions (issue #27) into a reusable reference for future integrators, cross-linked from both the ollacrm page and the onboarding index. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 7c7378b commit acca4e8

7 files changed

Lines changed: 386 additions & 1 deletion

File tree

website/docs/ai-developer/plans/backlog/1PRIORITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Separately, two more things shipped in the same session: (1) a real Grafana Clou
5757

5858
## Tier 1 — next up
5959

60+
- [`INVESTIGATE-issue26-ollacrm-feedback.md`](INVESTIGATE-issue26-ollacrm-feedback.md) — **new**, triages [GitHub issue #26](https://github.com/helpers-no/sovdev-logger/issues/26) (ollacrm's consolidated production feedback). Two confirmed, real, one-line bugs ready for a `PLAN-*.md`: `SOVDEV_LOGLEVELS.TRACE` silently collapses to `SeverityNumber.DEBUG` in `logger.ts`'s `severity_map` (OTel's own enum already has a distinct `TRACE=1`, unused), and `sovdev_test_otlp_connection()` still misreads HTTP `204` (Grafana Cloud's real success response) as unreachable — the same bug flagged, unfixed, since the original issue #23. Plus 3 confirmed onboarding-doc gaps (bundle size, `LOG_TO_FILE`, ERROR/FATAL→ServiceNow warning) and two genuine design questions: (1) should `sovdev_log()` throw or degrade gracefully when called before `sovdev_initialize()` in a consumer's own unit tests; (2) the auto-instrumentation import-order footgun the issue reported as "just" a doc gap turned out to have a real root-cause fix — checked directly against `@opentelemetry/auto-instrumentations-node`'s own bundled README: OTel's own best practice is a `--require`/`--import` preload flag, not calling init from inside app code at all. Recommends shipping the doc warning immediately and scoping a `sovdev-logger/register` preload entry point as its own follow-up plan (needs a real design decision on how `peer_services` moves from a function argument to an env-var shape). One item (`sovdev_generate_trace_id`) turned out to be already resolved — just needs a reply on the issue.
61+
62+
- [`INVESTIGATE-ollacrm-onboarding-usability.md`](INVESTIGATE-ollacrm-onboarding-usability.md)**new, active bug blocking ollacrm today**: step 3's published command (`NODE_OPTIONS="--env-file=..."`) fails outright — confirmed live in ollacrm's own terminal (`node: --env-file= is not allowed in NODE_OPTIONS`), a hard Node restriction, not a version quirk. Recommended fix (Option A): give `sovdev-selftest` its own `--env-file` argument via `process.loadEnvFile()`, pending [Q1] (verify the API actually works on the package's `>=22.0.0` floor — can't confirm locally, highest `nvm` version here is 21.6.1). Also documents a second, structural finding: the page's newest section only reached completeness through a live Q&A cycle with the maintainer, not because the doc was self-sufficient — flagged as Option B, a "cold start" dry-run process, for separate follow-up.
63+
6064
- [`INVESTIGATE-docs-site-structure.md`](INVESTIGATE-docs-site-structure.md)'s [Q5]**Option E1**, Grafana Cloud's public "Share externally" dashboard link. Absorbed from the now-retired `INVESTIGATE-developer-first-onboarding.md` (every other option there shipped; this was the one piece left, see that doc's own completed banner). Called out as the single highest-value, lowest-cost action across both investigations: a public, no-login dashboard link pre-filtered by `service_name` — closes the "prove it's working" loop for a developer who (confirmed, for ollacrm) has no Grafana Cloud login at all. No code changes, just a Grafana Cloud portal setting + confirming the pre-filtered URL pattern works.
6165
## Tier 2 — real, not urgent
6266

website/docs/ai-developer/plans/backlog/INVESTIGATE-issue26-ollacrm-feedback.md

Lines changed: 190 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Investigate: Make `using/onboarding/ollacrm/index.md` a real, self-serve checklist
2+
3+
Whether ollacrm can actually follow `using/onboarding/ollacrm/index.md` end-to-end on her own — surfaced by a real broken command in the page's own step 3, and by how much of the page's newest section only exists because of a live conversation with the maintainer, not because the doc was self-sufficient.
4+
5+
> **IMPLEMENTATION RULES:** Before implementing this plan, read and follow:
6+
> - [WORKFLOW.md](../../WORKFLOW.md) - The implementation process
7+
> - [PLANS.md](../../PLANS.md) - Plan structure and best practices
8+
9+
## Status: Backlog
10+
11+
**Goal**: A version of the ollacrm onboarding page that a developer can follow start-to-finish without needing a live conversation to fill gaps — proven by an actual cold-start attempt, not just a read-through.
12+
13+
**Last Updated**: 2026-07-14
14+
15+
---
16+
17+
## Background — two concrete gaps found the same day the page shipped
18+
19+
`using/onboarding/ollacrm/index.md` was rewritten this session into a clean 4-step checklist plus a "Using sovdev-logger itself" section, committed and pushed. The same day, walking through the real procedure surfaced two separate, concrete problems — not a vague "docs could be better" feeling.
20+
21+
### 1. Confirmed real bug: step 3's command fails exactly as documented
22+
23+
Step 3 reads:
24+
25+
```bash
26+
NODE_OPTIONS="--env-file=/path/to/the-file.env" npx sovdev-selftest --backend grafana-cloud
27+
```
28+
29+
Ollacrm's real terminal, running this literally:
30+
31+
```
32+
node: --env-file= is not allowed in NODE_OPTIONS
33+
```
34+
35+
This is a hard Node.js restriction, not a version quirk — Node explicitly blocklists a handful of flags (including `--env-file`) from being set via `NODE_OPTIONS`, almost certainly because `NODE_OPTIONS` is itself an environment variable, and allowing it to force-read an arbitrary file would be a security footgun. Confirmed locally: `NODE_OPTIONS="--env-file=/dev/null" node -e "..."` fails identically on this machine (Node 20.11.0), and this is documented Node behavior, not something that improves at a later Node version.
36+
37+
**Root cause of how this shipped broken**: earlier this session, `dotenv-cli` was replaced with `NODE_OPTIONS="--env-file="` specifically to avoid requiring non-Node developers to install an extra Node-specific tool just to set env vars — a deliberate call favoring language-agnostic tooling for cross-language concerns. That substitution was never actually run end-to-end before being published — the first real test was ollacrm's own terminal, today.
38+
39+
### 2. The "Using sovdev-logger itself" section only exists because of a live Q&A cycle
40+
41+
Before this session, the page had **zero** mention of `sovdev_set_context()`, `client_name`, `service_principal`, or `acting_user` — despite all three already existing in the library and directly driving one of her own dashboard panels ("Active Clients" shows `0` without them). Arriving at the content now on the page required, in order:
42+
43+
- Being told directly which dashboard panel depends on which field — not written down anywhere beforehand.
44+
- Reading `INVESTIGATE-context-propagation.md` to recover the concrete value `client_name` should hold for her specifically (her registered frontend names, e.g. `olla.helsestell.no`) — not on the onboarding page itself.
45+
- A live back-and-forth to establish that `acting_user` is effectively mandatory for her API specifically (every call is user-scoped), contradicting the general library docs' "only when applicable" framing.
46+
- Reviewing her actual `requireUser` middleware table to confirm `client_name`/`service_principal` were wired correctly, and catch that `acting_user` was a raw email rather than a pseudonymous ID.
47+
48+
None of this reflects badly on the page's *current* content — it's now accurate and complete. The concern is structural: **the page's completeness depended entirely on a maintainer already holding all this context, asking the right questions in real time.** The next customer after ollacrm won't have that conversation available.
49+
50+
---
51+
52+
## Options
53+
54+
### Option A: Fix the immediate command bug directly, as its own small fix
55+
56+
Give `sovdev-selftest` (and any future sovdev-logger CLI) its own `--env-file <path>` argument, loaded internally via Node's `process.loadEnvFile()` API — never touching `NODE_OPTIONS` at all. Since `sovdev-selftest` is already a Node program, this doesn't reintroduce the "don't force non-Node developers to install Node" problem the `NODE_OPTIONS` switch was originally solving — that concern is about a *consumer's own app*, not about running this CLI, which already requires Node.
57+
58+
**Not yet verified**: `process.loadEnvFile()`'s availability at the package's stated `engines.node: >=22.0.0` floor. Confirmed `undefined` on the highest version installed locally via `nvm` (21.6.1) — needs a real Node 22 install to confirm it's actually present and stable there, not just check documentation.
59+
60+
**Alternative within this option**: invoke `node` directly with its own `--env-file` flag (valid as a direct CLI arg — only disallowed inside `NODE_OPTIONS`), pointed at the CLI's resolved entry file instead of going through `npx`. Rejected as the primary fix: fragile (differs by install method — local vs global vs monorepo), and reintroduces exactly the kind of "one more thing to get right" step 3 was trying to avoid.
61+
62+
**Pros**: small, targeted, fixes the actively-broken command today.
63+
**Cons**: doesn't address the second, structural gap (section 2 above) at all.
64+
65+
### Option B: A "cold start" dry-run process for onboarding docs generally
66+
67+
Before considering any onboarding page (ollacrm's, or a future generic template) done, have a fresh reviewer — an agent with no prior context on this project, or a real person unfamiliar with the internals — attempt to follow it literally, step by step, in an isolated environment, and report every point they got stuck, had to guess, or hit a command that failed. This is a **dry-run** review, structurally different from a read-through review: a read-through catches unclear prose, a dry-run catches exactly the class of bug found here (a command that reads fine but has never actually been executed).
68+
69+
**Pros**: would have caught the `NODE_OPTIONS` bug before ollacrm did; directly targets the structural problem (docs whose completeness depends on the author's live availability), not just today's symptom.
70+
**Cons**: process work, not a one-time fix — needs deciding when this dry-run happens (before every onboarding-doc edit? only before major rewrites?) and who/what performs it cheaply enough to actually happen.
71+
72+
### Option C: Do nothing beyond the command fix, treat future gaps as they surface
73+
74+
**Pros**: zero process overhead.
75+
**Cons**: this is the second time in one session a real gap in this exact page was found only because a real user hit it live — no reason to expect this was the last one, and the next customer after ollacrm won't have a maintainer on a live call to unblock them.
76+
77+
---
78+
79+
## Recommendation
80+
81+
**Option A now** (fix the actively-broken command — ollacrm is blocked on this today), **Option B as the actual answer to "how do we know it's self-serve"** — worth scoping as its own follow-up once Option A ships, rather than bundling a process change with today's urgent fix.
82+
83+
---
84+
85+
## Open Questions
86+
87+
1. **[Q1]** Does `process.loadEnvFile()` actually work as expected on Node `>=22.0.0` (this package's stated floor)? Not verifiable on this machine today (`nvm`'s highest installed version is 21.6.1, where the API is `undefined`) — needs a real Node 22 install to confirm before committing to Option A.
88+
2. **[Q2]** Should the fixed command still be demonstrated as working *before* being handed to the next real customer, given the `NODE_OPTIONS` command was published without that check? What's the minimum verification that would have caught this (a CI step, a local smoke test, a dry run per Option B) without over-engineering a one-line doc fix?
89+
3. **[Q3]** Does Option B belong on every onboarding-doc change, or only substantial rewrites (like the one that shipped this session)? A cost/frequency question, not yet answered.
90+
4. **[Q4]** Should the concrete field-value guidance recovered this session (which env var maps to which dashboard panel, what `client_name`/`service_principal`/`acting_user` should actually contain for a JWT-driven, DB-impersonating API like ollacrm's) be generalized into reusable guidance for the *next* customer, or is it inherently ollacrm-specific? Relates to [Q2] in `INVESTIGATE-docs-site-structure.md` (whether a generic developer-quickstart template is worth building yet).
91+
92+
## Next Steps
93+
94+
- [ ] **[Q1]** Install a real Node `>=22.0.0`, confirm `process.loadEnvFile()` behavior directly
95+
- [ ] Draft a `PLAN-*.md` for Option A once [Q1] is confirmed
96+
- [ ] Decide scope/cadence for Option B ([Q3]) — separate from the urgent fix
97+
- [ ] Re-verify step 3's fixed command with ollacrm herself once shipped
98+
99+
## Files to Modify (Option A)
100+
101+
- `typescript/src/cli/selftest.ts` (or wherever the CLI entrypoint lives) — accept `--env-file <path>`, load via `process.loadEnvFile()`
102+
- `website/docs/using/onboarding/ollacrm/index.md` — update step 3's command
103+
- `website/docs/using/onboarding/index.md` — check for the same `NODE_OPTIONS` pattern elsewhere, if present
104+
- `typescript/README.md` — same, if the broken pattern is documented there too

website/docs/using/onboarding/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Once the new system is actually wired up (not the disposable `-selftest` data fr
8484

8585
Real systems that have gone through this recipe, with the exact snippets that made it concrete:
8686

87-
- [ollacrm](ollacrm/index.md) — a TypeScript/Hono service on Cloud Run, sovdev-logger's first external consumer
87+
- [ollacrm](ollacrm/index.md) — a TypeScript/Hono service on Cloud Run, sovdev-logger's first external consumer. See also its [logging conventions](ollacrm/conventions.md) — real field-mapping and log-level patterns across ~90 production call sites.
8888

8989
## See also
9090

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "ollacrm",
3+
"link": {
4+
"type": "doc",
5+
"id": "using/onboarding/ollacrm/index"
6+
}
7+
}

0 commit comments

Comments
 (0)