refactor: reuse kernel uniqueStrings instead of local copies - #1892
Merged
Conversation
Three modules hand-rolled local uniqueStrings helpers despite the AGENTS.md reuse rule and the canonical export in @agent-device/kernel/collections: - src/platforms/apple/core/perf-frame.ts (identical semantics) - src/platforms/web/agent-browser-lifecycle.ts (empty-string filter now composed at the one call site that receives caller input; the home marker call site passes path.join results that are never empty) - packages/selectors/src/internal/build.ts (identical semantics) All three files' packages already depend on @agent-device/kernel and siblings import the same subpath.
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
Member
Author
|
Reviewed exact head |
|
This was referenced Aug 20, 2026
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.
What
Replaces three hand-rolled local
uniqueStringshelpers with imports of the canonical@agent-device/kernel/collectionsexport, per the AGENTS.md reuse rule:src/platforms/apple/core/perf-frame.ts— identical semantics, direct swap.src/platforms/web/agent-browser-lifecycle.ts— the local copy also filtered empty strings; that filter is now composed at the one call site that receives caller input (openWebSessionNames). The other call site passespath.joinresults, which are never empty. The[...]spread is gone because the kernel helper acceptsreadonly string[].packages/selectors/src/internal/build.ts— identical semantics, direct swap.All three files' packages already depend on
@agent-device/kerneland sibling modules import the same subpath.Why no gate caught this drift (evaluated as part of this task)
fallow auditdoes include duplication, but the repo floors areminTokens: 50/minLines: 5and these helpers are ~2 lines / ~15 tokens. Empirically (scratch run), mild-mode clone detection does group all three bodies at--min-tokens 5 --min-lines 1, but floors that low are unusable repo-wide (the 3-file toy already reports 66.7% duplication). The audit gate is also changed-files-only, so pre-existing drift is invisible until touched. Structural gap, not a config bug.no-restricted-syntaxandid-denylistare not implemented in oxlint 1.69 (checked the configuration schema), so a declaration-name ban is not expressible in the current lint config. oxlint 1.69 does support experimental customjsPlugins, which could express "no localuniqueStringsdeclaration outside packages/kernel" in ~30 lines riding the existingpnpm lintgate.banned-call/banned-importkinds — cannot ban a local declaration.Notably, the other two helpers protected by the same AGENTS.md rule (
inferFillText,evaluateIsPredicate) have exactly one definition each — only the trivially re-typeable one drifted. Whether that recurrence justifies a jsPlugin lane (per the Catches/Evidence/Cost/Kill-criterion bar) is left as a follow-up decision, not bundled here.Verification
pnpm check:affected --run— all runnable checks passed (lint, typecheck, affected units, changed-line coverage gate).