Skip to content

refactor(display-redaction): simplify mask.ts internals - #14545

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14454-42601500233-1
Nov 9, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14454-42601500233-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14454

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified plugins/display-redaction/hooks/mask.ts without changing behavior. The inline object types repeated in backtrackCost are now named Group and Quantifier. The escape loop in maskText destructures each range once instead of casting escapes[k] three times. walk's guard now reads depth, then arrays, then non-plain objects, with the same results and the same call order. register.tsx is unchanged: the one simplification there (moving the palette read into a local draw helper that takes $) failed the engine's module validator, which refuses passing $ to a closure declared inside register, so I reverted it. types/index.d.ts is unchanged, as the issue requires.

Not verified

  • The display-redaction test suites (hooks/mask.test.ts, hooks/display-redaction.test.ts) and 'claude plugin test' for mods were not run here: this lane has no test runner, and check-affected skips them because they run code from the checked tree. Left to the PR's CI.
  • tidy-diff markdown passes (write-for-humans, ai-slop) skipped for the changelog fragment: the issue dictates its text word for word.
  • register.tsx was not simplified: its one candidate (folding the palette read into a local draw helper) failed the engine validator's rule against passing $ to a closure inside register. Other candidates (a shared handler for the three text components) needed generic typing on 'on' that I could not…
  • typos check skipped by check-affected (typos not installed).

Fix

  • plugins/display-redaction/hooks/mask.ts: added type aliases Group and Quantifier for backtrackCost's repeated inline types; destructured the escape range once in maskText's loop and turned the loop condition into an early break; split walk's combined guard into ordered depth/array/plain checks
  • .changes/display-redaction/work-resolve-issue-issue-14454-42601500233-1-66699154.md: new patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 9e2ac7a:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 2 fragments valid
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: first run failed validate-plugins on a register.tsx change (the engine validator refuses passing $ to a local closure); after reverting that change, 12 passed, 7 skipped
  • fresh-context review subagent on the mask.ts diff: no behavior difference or type error found (it checked loop equivalence, call order in walk including Proxy traps, and type narrowing)
  • code-tidying:tidy-diff over the 9 changed hunks: no edits; one proposal to keep the indexed-access 'as Range'/'as Group' casts, which match the file's existing style
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42601500233

Left out: the items under Not verified.

Related

#14454

Merge-Risk: max=HIGH demote=true head=9e2ac7ae523cb494fdb8a4f9e2017a527c621e91 rubric=8.1.4 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 9e2ac7ae523cb494fdb8a4f9e2017a527c621e91: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of both changed files: plugins/display-redaction/hooks/mask.ts and the new changelog fragment. Neither matches a trusted-path glob.

Behavior equivalence in mask.ts. I checked each change by reading it. I did not run any tests.

  • Group and Quantifier type aliases. They only rename the inline types they replace. The runtime code is unchanged.
  • maskText escape loop. The old guard was k < length && escapes[k][0] < end. It is now k < length plus if (escStart >= end) break as the first statement of the body. The loop body has no continue, so the stop condition is checked at the same point on every pass. k is scoped to the loop. The results are identical.
  • walk guard split.
    • Depth over the limit still returns the mask first.
    • Arrays are still mapped.
    • A non-array object that is not a plain object still returns the mask.
    • isPlain calls Object.getPrototypeOf once on non-arrays, as before, so a Proxy getPrototypeOf trap still fires the same number of times.
    • Array.isArray now runs once instead of twice. It fires no Proxy trap, and a revoked proxy still throws on the first call. Nothing observable changes.

Closing issue #14454 acceptance criteria.

  • Behavior unchanged: met, by the reading above. No test suite was run in this lane, so this is unverified by execution. hooks/mask.test.ts covers these paths, and the PR leaves running it to CI.
  • Diff edits only the listed files and fragments: met.
  • Within 400 lines and 15 files: met.
  • Fragment is a patch with ### Changed and "Internal simplification, no behavior change.": met. The PR body's ### text uses fullwidth characters, but the fragment file itself has an ASCII ### Changed heading.
  • types/index.d.ts unchanged: met.
  • ci-status green: not checked here, because this lane cannot see CI.

The verification described in the PR body (check-affected, the changelog-fragment and changed-skill checks, the subagent review) was run by the author's lane. I have not checked it.

No plugin manifest changed. No prior findings or settled threads apply. No embedded instructions were found in the PR context.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 9e2ac7ae523cb494fdb8a4f9e2017a527c621e91: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14545, simplify display-redaction mask.ts internals

No security issues found. I read every hunk of both changed files. Neither matches a trusted-path glob, and the diff doesn't touch a manifest, a trust control or an instruction surface.

The change sits in a redaction hook, so I checked that the masking behavior is the same before and after:

  • maskText escape loop (mask.ts#L189-L200): the old loop condition k < escapes.length && escapes[k][0] < end is now k < escapes.length with if (escStart >= end) break at the top of the body. The loop stops on the same element, and s/e are computed from the same values. Which spans get masked is unchanged, so this can't leak text that used to be masked.

  • walk guard (mask.ts#L289-L291): the old guard was depth >= MAX_DEPTH || !(Array.isArray(value) || isPlain(value)), followed by the array branch. The new code checks depth, then arrays, then !isPlain. Every input gets the same result:

    • at or past the depth cap: masked
    • an array: walked
    • an object that isn't plain: masked whole
    • a plain object: walked

    The calls run in the same order: the old || short-circuit also skipped isPlain for arrays, and Array.isArray hits no Proxy trap. Objects that aren't plain are still replaced by the mask.

  • Group / Quantifier aliases: these are type-only and produce no runtime change. backtrackCost's ReDoS cost logic is unchanged.

  • Changelog fragment: a patch-bump prose fragment. Nothing in it runs.

Embedded text in the PR context: none that tells the lane to do anything.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 9e2ac7ae523cb494fdb8a4f9e2017a527c621e91, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9e2ac7a

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14545-9e2ac7ae523cb494fdb8a4f9e2017a527c621e91, expires on 2026-12-09.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 2fc86ff Nov 9, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14454-42601500233-1 branch November 9, 2026 11:57
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 0, survived 7, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 0%; mutation score 0%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/display-redaction/hooks/mask.ts 0 7 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/display-redaction/hooks/mask.ts:189 ROR unclassified none
plugins/display-redaction/hooks/mask.ts:190 other unclassified none
plugins/display-redaction/hooks/mask.ts:191 SBR productive input-gap
plugins/display-redaction/hooks/mask.ts:192 other unclassified none
plugins/display-redaction/hooks/mask.ts:193 other unclassified none
plugins/display-redaction/hooks/mask.ts:289 ROR productive input-gap
plugins/display-redaction/hooks/mask.ts:291 SBR unclassified none

The run's summary has the full report.

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.

Simplify the hooks and types display-redaction plugin code

0 participants