|
| 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 |
0 commit comments