Skip to content

feat(tour): add NBI_TOUR_DISABLED to stop the first-run tour from opening - #495

Merged
mbektas merged 3 commits into
plmbr:mainfrom
FelipeRamos-neuro:feat/nbi-tour-disabled
Sep 24, 2026
Merged

mbektas merged 3 commits into
plmbr:mainfrom
FelipeRamos-neuro:feat/nbi-tour-disabled

Conversation

@FelipeRamos-neuro

Copy link
Copy Markdown
Contributor

Summary

Adds NBI_TOUR_DISABLED so a deployment can turn the first-run tour off without maintaining an override file.

Closes #494

Problem

The tour had no on/off switch. NBI_TOUR_CONFIG_PATH only points at an override file whose schema can drop individual steps, so suppressing the tour meant a file with enabled: false for every step id. That breaks silently when a release adds a step.

Solution

  • NBI_TOUR_DISABLED=1 (env) or NotebookIntelligence.tour_disabled (traitlet). The env var wins.
  • The server publishes tour_disabled in the capabilities response and the sidebar skips its first-run auto-show when it is set. The decision lives in a small shouldAutoShowTour helper so it is unit-testable.
  • The "Show NBI tour" command still replays the tour on demand.
  • An unrecognized env value warns and falls back to the traitlet instead of raising. _resolve_bool_with_env fails loudly on purpose for security gates, but this is a cosmetic switch, so a typo must not stop the extension from loading. The strict resolver is unchanged.

The switch does not mark the tour completed, so removing it later shows the tour again to users who never finished it. This is documented in docs/admin-tour-config.md, and the new settings are in the docs/admin-guide.md table.

Testing

  • tests/test_tour_disabled.py: env vs traitlet precedence, the typo fallback and its warning, that _setup_handlers publishes the resolved value, and that the capabilities response carries tour_disabled. Removing either the response line or the wiring makes these fail. The _setup_handlers test restores the class state it touches so it cannot leak into other tests (an earlier version opened a security gate another test expects closed).
  • tests/ts/tour-state.test.ts: shouldAutoShowTour on first run, after completion, and when disabled.
  • Also checked against a running Jupyter server: the capabilities endpoint returned tour_disabled false when unset or 0, and true with NBI_TOUR_DISABLED=1. With an invalid value the extension previously failed to load; it now falls back.
  • pytest tests/ (2233 passed), jlpm jest (579 passed), jlpm tsc --noEmit and jlpm lint:check are clean.

Not checked in a browser: that the tour stays closed on a fresh profile with the switch on. The logic is covered by unit tests and the capabilities check above.

🤖 Generated with Claude Code

FelipeRamos-neuro and others added 2 commits September 21, 2026 18:14
…ning

The tour could only be silenced by writing an override file that disabled
every step id, which breaks whenever a step is added. Add a real switch:
the NBI_TOUR_DISABLED env var (or tour_disabled traitlet, env wins) is
published in the capabilities response and the sidebar skips its first-run
auto-show. The "Show NBI tour" command still replays the tour on demand.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A cosmetic switch should not be able to stop the extension from loading, so an
unrecognized NBI_TOUR_DISABLED value now warns and falls back to the
tour_disabled traitlet instead of raising. The strict resolver stays in place
for the security gates.

Add tests that _setup_handlers publishes the resolved value, that the
capabilities response carries it, and that the lenient fallback warns, and
document that the switch does not mark the tour completed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@mbektas mbektas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mbektas
mbektas merged commit a1a9519 into plmbr:main Sep 24, 2026
3 of 4 checks passed
@FelipeRamos-neuro
FelipeRamos-neuro deleted the feat/nbi-tour-disabled branch September 25, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an environment variable to disable the first-run tour

2 participants