Skip to content

Validate Roku channel types#589

Open
jsdavid278-cyber wants to merge 1 commit into
profullstack:masterfrom
jsdavid278-cyber:codex/roku-channel-type-validation
Open

Validate Roku channel types#589
jsdavid278-cyber wants to merge 1 commit into
profullstack:masterfrom
jsdavid278-cyber:codex/roku-channel-type-validation

Conversation

@jsdavid278-cyber
Copy link
Copy Markdown
Contributor

Fixes #588.

Changes:

  • validate tv-roku channelType at runtime before package planning or shipping
  • keep generated plan and ship metadata normalized to public, beta, or private
  • add regression tests for invalid channelType in build and dry-run ship flows

Validation:

  • vitest run packages/targets/tv-roku/src/index.test.ts
  • tsc -p packages/targets/tv-roku/tsconfig.json --noEmit

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 5, 2026

Greptile Summary

This PR adds runtime validation of the channelType config field for the tv-roku target, ensuring only the accepted values (public, beta, private) can flow into package planning or shipping. It also extracts a shared writeValidRokuProject helper in the test file to avoid repetition, and adds two new regression tests for the invalid-channelType path in both build and ship.

  • index.ts: Introduces CHANNEL_TYPES constant and requireChannelType() validator; both packagePlan and ship now call it early, before any I/O, so invalid values surface immediately.
  • index.test.ts: Extracts writeValidRokuProject helper inside describe, then adds one test for the build path and one for the ship path with an invalid 'preview' channelType.

Confidence Score: 5/5

Safe to merge — the change is a focused guard added in two places with matching test coverage and no regressions to existing behavior.

The validation logic is correct: requireChannelType delegates to requireValue for the empty/undefined case, then checks membership against the CHANNEL_TYPES tuple before any I/O. Both build (via packagePlan) and ship validate early and consistently. The two new tests exercise the exact error path end-to-end and cover both entry points. No pre-existing tests were broken.

No files require special attention.

Important Files Changed

Filename Overview
packages/targets/tv-roku/src/index.ts Adds CHANNEL_TYPES constant and requireChannelType() guard; both packagePlan and ship validate channelType early before any I/O — logic is correct and consistent.
packages/targets/tv-roku/src/index.test.ts Extracts writeValidRokuProject helper and adds two new rejection tests; cleanup via tempDirs/afterEach is handled correctly for all new paths.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[caller invokes build or ship] --> B{config.channelType?}
    B -->|undefined / empty| C[requireValue throws\n'tv-roku requires channelType']
    B -->|non-empty string| D{CHANNEL_TYPES.includes?}
    D -->|'preview' / other unknown| E[requireChannelType throws\n'tv-roku channelType must be one of:\npublic, beta, private']
    D -->|'public' / 'beta' / 'private'| F[validated channelType returned]
    F --> G{build or ship?}
    G -->|build| H[packagePlan: stat sourceDir,\nparse manifest, write plan JSON]
    G -->|ship| I{dryRun?}
    I -->|true| J[return dry-run metadata\nwith channelType + destination]
    I -->|false| K[return real ship metadata\nwith artifact + channelId]
Loading

Reviews (1): Last reviewed commit: "Validate Roku channel types" | Re-trigger Greptile

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.

tv-roku accepts unsupported channel types

1 participant