Skip to content

refactor(scripts): extract gate-common.mjs, decompose verify-pr-checks + verify-no-control-bytes #310

Description

@dean0x

Summary

Consolidate release-gate tooling by extracting common Result/validation patterns from verify-pr-checks.mjs and verify-no-control-bytes.mjs into a shared scripts/lib/gate-common.mjs. Decompose the two 224-line main/evaluateChecks functions.

Deferred Issues

From review [wave-v0.4.0-wave1/2026-08-19_1216]:

Finding File:Line Reason
architecture-05 scripts/verify-no-control-bytes.mjs:530 Two-file extraction + test-harness rewrite on release-gate tooling.
architecture-09 scripts/verify-no-control-bytes.mjs:467 Rewriting the scanner core of a live security gate.
complexity-05 scripts/verify-pr-checks.mjs:218 Decomposing the function that gates every merge, days before an irreversible tag.
complexity-06 scripts/verify-no-control-bytes.mjs:530 Exporting main would rewrite 33 of 46 spec tests.

Acceptance Criteria

  • Extract scripts/lib/gate-common.mjs with Result types and validation utilities
  • Refactor verify-pr-checks.mjs to decompose 224-line main function
  • Refactor verify-no-control-bytes.mjs to decompose 224-line evaluateChecks function
  • All 46 spec tests pass with new decomposition
  • Both scripts maintain exact output compatibility

Related

For v0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions