Repository navigation
CI: add standalone duplication ratchet with actionable reports - #97
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Active critical and moderate findings remain in the CI gate and duplication checker, including bypassable candidate tooling changes, an invalid migration path, broken report resolution, and incomplete baseline-derived metrics.
4 open issues
1 file not reviewed
tools/duplication/package-lock.json: Generated file
What changed in this PR
Adds a standalone, pinned jscpd-based duplication ratchet for production sources, with report-only test scanning, baseline bootstrapping, automatic main-branch ratcheting, actionable reports, and contributor documentation.
Changes:
- Adds duplication policies, independent metrics, baseline validation, and ratcheting.
- Adds CI jobs for production gating, reporting, artifacts, annotations, and baseline updates.
- Adds tooling tests, isolated package metadata, exclusions, and local reproduction guidance.
This pull request requires changes.
| File | Description |
|---|---|
tools/duplication/README.md |
Documents duplication checks, lifecycle, exclusions, reports, and repository setup. |
tools/duplication/policy.json |
Defines scanner settings, source cohorts, exclusions, and gated scans. |
tools/duplication/package.json |
Adds the isolated development-only jscpd package and scripts. |
tools/duplication/package-lock.json |
Pins the duplication tooling dependency tree. |
tools/duplication/metrics.mjs |
Implements metric extraction, baseline validation, limits, ratcheting, and output escaping. |
tools/duplication/check.mjs |
Selects sources, runs scans, generates reports, evaluates gates, and emits CI summaries. |
tools/duplication/check.test.mjs |
Tests scanning, baselines, regressions, source selection, reports, and security handling. |
tools/duplication/baseline.json |
Adds the initial pending-bootstrap baseline sentinel. |
README.md |
Adds contributor-facing duplication-check documentation. |
.gitignore |
Ignores local duplication dependencies and generated reports. |
.github/workflows/ci.yml |
Adds the standalone duplication gate and main-only baseline update workflow. |
Review effort: Lite
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.


Why
Make duplication measurable and prevent production duplication from growing in future PRs. Reports should tell both maintainers and Codex exactly where to investigate, rather than merely reporting an opaque percentage.
Changes
Independent CI gate
First-run baseline and automatic ratcheting
pending-bootstrapbaseline: the first measurement establishes the benchmark and passes the duplication gate without arbitrary initial limits. Tooling/scanner failures still fail.Actionable output
Initial production measurements
These are observed results, not manually imposed ceilings. The initial successful main run persists its own measurements.
The full local base/head/test scan takes approximately 6–8 seconds; runner checkout, npm setup and artifact upload add CI overhead.
Validation
npm audit --prefix tools/duplication --audit-level=high: zero known vulnerabilities.git diff --checkpass.make screenshots-check: all seven existing terminal screenshots verified unchanged for v0.27.2.Repository setup after merge
Make Duplication ratchet a required branch check and require up-to-date branches (or merge-queue validation) if it should block merges. A workflow alone cannot enable branch protection. Actions and repository rules must permit the narrowly scoped main-only baseline writer. If the push is blocked, the writer fails and preserves a measured artifact for diagnosis; fix repository configuration and rerun it rather than editing the PR's baseline or granting broad bypass rights.
No TUI/web behaviour, release version or application dependency changes.