Skip to content

Conversation

@rtibbles
Copy link
Member

@rtibbles rtibbles commented Jan 12, 2026

Summary

Adds support for using channel tokens in addition to channel IDs when importing channels via the importchannel management command.

Key features:

  • Token resolution via Kolibri Studio's channel lookup API
  • Automatic detection of tokens vs channel IDs using UUID validation
  • Clear error when token resolves to multiple channels (lists all options)
  • Full backward compatibility with existing channel ID usage

Example usage:

kolibri manage importchannel network tahid-modal

References

Fixes #3733

Reviewer guidance

  • Token resolution only applies to the network subcommand; disk requires UUIDs since tokens need network access to resolve
  • Test coverage includes unit tests for resolve_channel_token() and integration tests in test_import_export.py

@github-actions github-actions bot added DEV: dev-ops Continuous integration & deployment DEV: backend Python, databases, networking, filesystem... APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend SIZE: very large labels Jan 12, 2026
@rtibbles rtibbles changed the base branch from develop to release-v0.19.x January 12, 2026 05:09
@rtibbles rtibbles force-pushed the claude/plan-import-issue-01PLz3FuYjwoyrk7gttdFysn branch from 7f66ea8 to f9d039f Compare January 13, 2026 03:24
@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

@rtibbles rtibbles removed SIZE: very large DEV: dev-ops Continuous integration & deployment DEV: frontend APP: Learn Re: Learn App (content, quizzes, lessons, etc.) labels Jan 13, 2026
@rtibbles rtibbles force-pushed the claude/plan-import-issue-01PLz3FuYjwoyrk7gttdFysn branch from f9d039f to a9dbaa8 Compare January 13, 2026 15:38
Implements support for using channel tokens in addition to channel IDs
when importing channels via the importchannel command, addressing issue #3733.

Key features:
- Token resolution via channel lookup API (works with Studio or any Kolibri instance)
- Automatic detection of tokens vs channel IDs using UUID validation
- Interactive multi-channel selection when token resolves to multiple channels
- Non-interactive mode shows error with all channel options
- Comprehensive error handling with user-friendly messages
- Full backward compatibility with existing channel ID usage

Implementation details:
- Added resolve_channel_token() utility in paths.py using duck typing
- Returns tuple of (channel_id, all_channels) for flexible handling
- Command detects TTY to determine interactive vs non-interactive mode
- Interactive mode prompts user to choose from numbered list
- Non-interactive mode fails with clear error listing all options
- Only network subcommand supports tokens (disk requires UUIDs)

Error handling improvements:
- JSON parse errors caught with helpful messages
- Network failures, invalid tokens, malformed responses all handled
- Validates all channels have IDs before returning
- Clear error messages guide users to resolution

Test coverage:
- Token resolution (single and multiple channels)
- Invalid JSON responses
- Missing channel IDs
- Default and custom baseurl
- All error paths covered

Fixes #3733
@rtibbles rtibbles force-pushed the claude/plan-import-issue-01PLz3FuYjwoyrk7gttdFysn branch from a9dbaa8 to 940d830 Compare January 13, 2026 17:42
@rtibbles rtibbles marked this pull request as ready for review January 13, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DEV: backend Python, databases, networking, filesystem... SIZE: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow command-line import to take a token as a parameter

4 participants