Validate eval/rsg_version against firmware lifecycle#1698
Open
Validate eval/rsg_version against firmware lifecycle#1698
Conversation
Adds firmware-aware diagnostics for `eval` calls and the manifest's
`rsg_version` entry, driven by lifecycle metadata in a new
`src/RokuConstants.ts`.
New behavior:
- `eval(...)` is flagged when the effective rsg_version >= 1.2 (where
Roku sunset eval as a compile error).
- Manifest `rsg_version` is validated against the configured firmware:
- rsg_version=1.0 → flagged as deprecated/removed depending on the
user's effective min FW.
- rsg_version=1.1 → flagged as removed at firmware 14.5 (Roku
silently treats it as 1.2 from there on).
- rsg_version=1.2 → flagged as deprecated at firmware 15.1+ in
favor of 1.3 (cert deadline 2026-10-01).
- rsg_version=1.3 → flagged as requiring firmware 15.0+.
- Invalid format (non-semver) → warning.
When the user hasn't configured `minFirmwareVersion`, brighterscript
now assumes a default of 15.0.0 so these diagnostics are useful out
of the box. Users targeting older firmware can opt out by setting
`minFirmwareVersion` explicitly.
Lifecycle data lives in a single `RSG_VERSIONS` map sourced from
Roku's developer release notes and channel-manifest documentation;
adding a new rsg_version is one entry there.
6 tasks
TwitchBronBron
requested changes
May 4, 2026
Address PR feedback: - Add Availability/AvailabilityInfo to Callable. Eval is tagged with os.deprecated=9.0.0 and rsg.removed=1.2.0; a single CallExpression visitor walks any global callable's availability. Adding a new callable's lifecycle is just metadata. - The validator emits at most one diagnostic per call: rsg axis takes precedence; os axis fires only when rsg is silent. Avoids duplicate diagnostics on the same line for the common-case modern firmware. - Replace evalIsDeprecatedAtRsgVersion with two generic diagnostics (`globalCallableRemoved`, `globalCallableDeprecated`) parameterized by name + axis + threshold + current. Messages match the existing style of featureRequiresMinFirmwareVersion (threshold AND current target). - Diagnostic codes 1147–1152 are renumbered so they appear in numeric order in DiagnosticMessages.ts. - Mark Callable.isDeprecated as @deprecated; availability supersedes it. - Rename getEffectiveMinFirmwareVersion -> getMinFirmwareVersion. Cache it and getRsgVersion. Both return canonical coerced semver strings so downstream callers don't re-coerce. - Drop redundant semver.coerce calls in ProgramValidator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds firmware-aware diagnostics for
eval(...)calls and the manifest'srsg_versionentry, driven by lifecycle metadata in a new src/RokuConstants.ts.What this catches
evalIsDeprecatedAtRsgVersioneval(...)call as removedrsgVersionRequiresMinFirmwarersg_version=1.3invalidRsgVersionFormatrsg_version=bananarsgVersionDeprecatedrsg_version=1.2rsgVersionRemovedrsg_version=1.0rsgVersionRemovedrsg_version=1.1Default-firmware behavior change
When the user hasn't configured
minFirmwareVersion, brighterscript now assumes a default of 15.0.0 so these diagnostics are useful out of the box. Users targeting older firmware can opt out by settingminFirmwareVersionexplicitly.This also affects the existing optional-chaining FW check (BrsFileValidator.ts) — same default applied uniformly via the new
Program.getEffectiveMinFirmwareVersion()helper.Implementation
introducedAt/becameDefaultAt/deprecatedAt/removedAt/replacement),DEFAULT_MIN_FIRMWARE_VERSION,OPTIONAL_CHAINING_MIN_FIRMWARE_VERSION,EVAL_REMOVED_AT_RSG_VERSION. Adding a new RSG version is one entry there; downstream validators pick it up.parseManifestEntries()(line-aware) alongside the existingparseManifest(). Public API unchanged.getEffectiveMinFirmwareVersion()(sanitizes garbage input → DEFAULT) andgetRsgVersion()(data-driven default selection). BothgetManifestEntries()andgetManifestPath()areprotectedfor now — no stable public API yet, will firm up when the manifest gets proper file-tracking support.RSG_VERSIONS. Removal takes precedence over deprecation; deprecation only fires when the user's effective firmware actually meets the deprecation threshold (so users on pre-deprecation firmware aren't nagged).validateEvalIsNotDeprecatednext to the existing optional-chaining check; both route throughgetEffectiveMinFirmwareVersion().Sources for lifecycle data
Known gaps / TODOs
These are documented inline so we can revisit as the manifest infrastructure matures:
{ srcPath, pkgPath }stub. Should be replaced by proper file tracking. Code actions for manifest diagnostics are deferred until then.getManifestEntries/getManifestPathaccessed via bracket notation — protected for now to avoid committing to a public API.becameDefaultAtsemantically broadened — for 1.0/1.1/1.2 it's "device silent fallback"; for 1.3 it's "Roku's cert-policy expected default" (since 1.3 isn't a runtime default but is required by Roku's static analysis tool). TODO comment in RokuConstants flags this for confirmation with Roku.Test plan
npm test— 2808 passing (+ ~40 new), 0 failingnpm run lint— cleanProgramValidator.spec.ts(every diagnostic in fire/don't-fire scenarios across firmware windows)evalvalidator tests inBrsFileValidator.spec.tscovering manifest-explicit / manifest-silent / dotted-method / case-insensitiveparseManifestEntriesline-aware parser testsProgram.getRsgVersion/getEffectiveMinFirmwareVersionsanitization tests🤖 Generated with Claude Code