chore(xgw): prefer String#slice() over String#substring()#87
Merged
Conversation
Three pre-existing lint annotations on brightfire/xgw surfaced by pre-push checks during PR #85's build-stable run: - src/gateway/xgw/outbound.ts:68 - src/gateway/server-methods/sessions-xgw.ts:47 - src/gateway/server-methods/sessions-xgw.ts:48 All three are non-negative integer arguments, so slice() and substring() behave identically. Pure hygiene change to clear lint debt that pre-dates the xgw canonical's latest PR (#72).
ryan-dyer-sp
added a commit
that referenced
this pull request
Jun 4, 2026
) The previous step ran prepush:ci with stderr silenced and a tsgo fallback: run: pnpm prepush:ci 2>/dev/null || pnpm tsgo This hid real failures and produced misleading 100s timing on every build. prepush:ci's first inner step (pnpm check) was failing on pre-existing lint debt; bash exited non-zero; the fallback pnpm tsgo ran in ~20s and the workflow continued. We never ran the strict-smoke bundle, the UI guard, or any of the lint surface that step purported to check. Once PRs #86 and #87 cleared the lint debt, prepush:ci ran to completion and exposed massive redundancy: it triples up on pnpm test (extensions config + unit config + full suite), all at maxWorkers=1, on top of the workflow's existing 'Run tests' step which already runs the full suite at PARALLEL=4 × MAX_WORKERS=2. The extension and unit configs are included in fullSuiteVitestShards, so 'Run tests' already covers them. Replaces the single silenced step with three explicit non-redundant checks before Build: - pnpm check (lint + arch + typecheck) - pnpm build:strict-smoke (bundle smoke + plugin-sdk dts) - pnpm lint:ui:no-raw-window-open (UI guard) prepush:ci's protocol regeneration is already handled by 'Regenerate build artifacts' with drift-absorb-via-commit semantics, which is the correct behavior for the squash-merge build-stable context (drift is expected, not a failure). prepush:ci's test invocations are dropped — they duplicate 'Run tests' slower and serial. No coverage lost. Steps remain sequential rather than backgrounded-parallel because tsgo and tsdown are memory-hungry (tsgo:prod alone wants 12GB heap); running concurrently risks OOM on the 32GB runner. GHA step-level overhead is ~0, so sequential gives clean logs and per-step timing. Expected wall-clock: prior ~22min (with silenced failure) -> new ~25-30min (actually doing the work). Saves ~15min of redundant test runs by dropping the inner prepush:ci test phase. Refs: #86, #87 Co-authored-by: Vash <vash@brightfire.net>
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
Clears three pre-existing
unicorn/prefer-string-slicelint annotations onbrightfire/xgwthat PR #85's build-stable run surfaced.Changes
src/gateway/xgw/outbound.ts:68—bodyText.substring(0, 200)→bodyText.slice(0, 200)src/gateway/server-methods/sessions-xgw.ts:47—rawKey.substring(1, slashIdx)→rawKey.slice(1, slashIdx)src/gateway/server-methods/sessions-xgw.ts:48—rawKey.substring(slashIdx + 1)→rawKey.slice(slashIdx + 1)Why
String#slice()is the modern preferred form. All three call sites pass non-negative integer arguments, so the behaviour ofslice()andsubstring()is byte-identical —substring()only differs fromslice()when given negative or out-of-order arguments. Pure hygiene change.Test plan
Refs