Skip to content

♻️ refactor(test): coverage tooling — phases 0-5 of 80% coverage roadmap - #4678

Draft
riccio82 wants to merge 39 commits into
update-designfrom
coverage-improvement-plan
Draft

♻️ refactor(test): coverage tooling — phases 0-5 of 80% coverage roadmap#4678
riccio82 wants to merge 39 commits into
update-designfrom
coverage-improvement-plan

Conversation

@riccio82

@riccio82 riccio82 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Multi-phase initiative to raise public/js line coverage from ~27% to an 80% floor, enforced
per-directory via Jest coverageThreshold so it can never regress. Full roadmap is a local planning doc
(docs/superpowers/plans/, gitignored in this repo, not part of this diff).

Progress so far:

  • Phase 0 (complete) — coverage tooling: exclude trivial files from the denominator, seed a
    per-directory coverageThreshold floored at each directory's measured coverage on update-design.
  • Phase 1 (complete) — raised 10 directories/files to an 80%+ line floor: footer, review,
    quality_report, globalFunctions.js, contextPreview, activityLog, sse (partial, 29%, by
    explicit budget), xliffToTarget (partial, 72%, by explicit budget), setTranslationUtil.js (95%),
    notificationsComponent.
  • Phase 2 (complete) — onBoarding, createProject, languageSelector, all raised to an 80% line
    floor. Covers SocialButtons, Login, ForgotPassword, PasswordReset, Register, the OnBoarding
    step-routing wrapper, SourceLanguageSelect/TargetLanguagesSelect/TmGlossarySelect/UploadFile,
    HomePageSection, useFileUploadManager/GDrive upload hooks, and LanguageSelector/
    LanguageSelectorSearch/LanguageSelectorList.
  • Phase 3 (complete) — outsource, projects, common, all raised to an 80% line floor. Coverage
    reached: outsource 8.3%→98.8%, projects 52.1%→84.8%, common 61.5%→81.0%. Covers the outsource
    quote/assignment flow (AssignToTranslator, OutsourceVendor, OutsourceContainer and children), the
    projects bulk-actions flow (ProjectsBulkActions and its Bulk* modals), and shared common UI primitives
    (Dropdown, Accordion, NumericStepper, ApplicationWrapper, form rule helpers, etc.).
  • Phase 4 (complete) — analyze, review_extended, both raised to an 80% line floor. Coverage
    reached: analyze 0%→94.9%, review_extended 9.3%→94.0%. Covers the analysis flow (AnalyzeMain,
    ProjectAnalyze, AnalyzeChunksResume, AnalyzeHeader and chunk/job analyze sub-components) and the
    review-extended (LQA) flow (ReviewExtendedIssue, ReviewExtendedIssuePanel,
    ReviewExtendedCategorySelector, ReviewExtendedIssuesContainer and related sub-components).
  • Phase 5 (complete) — hooks, modals, both raised to an 80% line floor. Coverage reached: hooks
    44.4%→98.1%, modals 10.0%→95.6%. Covers custom hooks (useAuth, useOutsourceQuote, useSocketLayer,
    useMediaQuery, useResizable, useCurrencyRates, useResizeObserver, useDeviceCompatibility,
    UseHotKeysComponent, useContextDocument) and modal components (SplitJob, PreferencesModal, ModifyTeam,
    JobMetadataModal, ShareTmModal, ShortCutsModal, RevisionFeedbackModal, CreateTeam, CopySourceModal, and
    the smaller confirm/alert modals plus the shared ModalContainer/ModalOverlay/modalRegistry plumbing).

Remaining roadmap: Phase 6 (actions, stores), Phase 7 (pages, utils), Phase 8 (header, api),
Phase 9 (settingsPanel), Phase 10 (segments, split into sub-phases).

Type

  • feat — new user-facing feature
  • fix — bug fix
  • refactor — restructure without behavior change
  • chore — build, deps, config, docs
  • perf — performance improvement
  • test — test coverage

Changes

File Change
jest.config.js Exclude **/index.js, components/icons/**, img/icons/** from collectCoverageFrom
jest.config.js Per-directory coverageThreshold ratchet — raised as each phase's tests land (see Summary)
public/js/components/footer/**, review/**, quality_report/**, globalFunctions.js, contextPreview/**, activityLog/**, sse/**, xliffToTarget/**, setTranslationUtil.js, notificationsComponent/** New/expanded test coverage (Phase 1)
public/js/components/onBoarding/**, createProject/**, languageSelector/** New test coverage (Phase 2)
public/js/components/outsource/**, projects/**, common/** New test coverage (Phase 3)
public/js/components/analyze/**, review_extended/** New test coverage (Phase 4)
public/js/hooks/**, components/modals/** New test coverage (Phase 5)

Migration Notes

N/A — no database migrations in this PR.

Testing

  • vendor/bin/phpunit --exclude-group=ExternalServices --no-coverage passes
  • ./vendor/bin/phpstan passes (0 errors, with baseline)
  • Manual testing performed (describe below)
  • New tests added for changed behavior
  • Regression tests added for bug fixes

yarn jest --watchAll=false --coverage passes with no threshold failures: 189 of 191 suites (2
pre-existing skips), 1733/1749 tests passing (16 pre-existing skips, unrelated to this change), exit
code 0.

AI Disclosure

  • No AI tools were used in this PR
  • AI tools were used — name the agent/tool below

Claude Code (Sonnet 5), used throughout to plan phases, implement tests via a subagent-drafted /
independently-verified workflow (dispatched agents draft and run tests, then their work is independently
re-verified against the real source and the full test suite before committing), and verify coverage/
threshold changes. Reviewed by the requester before merge.

Notes

Base branch is update-design (#4307), not develop, since that PR rewrites ~294 JS files and building
coverage against develop would discard most of that work. This branch is kept current with both lines
of development via periodic merges. No CI workflow changes are needed since the existing JS test step
already fails the build on a non-zero Jest exit code, which coverageThreshold failures now trigger.

This PR will continue to accumulate commits as later phases land — expect further pushes to this same
branch/PR rather than new PRs per phase.

@riccio82
riccio82 force-pushed the coverage-improvement-plan branch from a8ab66d to 47134be Compare July 14, 2026 13:10
riccio82 added 23 commits July 14, 2026 15:19
Previous fixture happened to already sit in descending order, so a broken
(no-op or sign-flipped) comparator produced the same output as the correct
one, masking the assertion. Reorder the fixture so the correct descending
sort actually changes element order.
Mock useSocketLayer to capture the eventHandlers map SocketListener builds,
then invoke disconnected/reconnected/force_reload/quota_exceeded/concordance/
logout/ack directly and assert on the resulting action calls. Raises
public/js/sse/ coverage threshold from 0 to 29 (actual: 29.62% lines).
…ation paths

Add unit tests for segmentTranslation's offline-queue branch, the fuzzy-match
and propagation confirmation modals, execSetTranslationTail's success/error
paths, and the propagation notification branches. Raises the file's coverage
threshold from 5% to 95% (actual: 97.74% lines / 85.58% branches).
…ertion

The "locked segments have been excluded" regex is a substring of the
not_ice branch's "non-locked segments have been excluded" text, so it
passed regardless of which branch ran. Add a negative assertion ruling
out the non-ice phrasing to genuinely prove the ice branch executed.
@gitguardian

gitguardian Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 10 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
34906997 Triggered Generic Password 2ba2cbc public/js/components/onBoarding/Register.test.js View secret
35024100 Triggered Generic Password 43f2cf0 public/js/components/outsource/AssignToTranslator.test.js View secret
35024102 Triggered Generic Password 43f2cf0 public/js/components/outsource/AssignToTranslator.test.js View secret
35024101 Triggered Generic Password 43f2cf0 public/js/components/projects/ChunksJobContainer.test.js View secret
35039354 Triggered Generic Password 4306a72 public/js/components/analyze/ProjectAnalyze.test.js View secret
35065435 Triggered Generic Password 5f1762a public/js/stores/ProjectsStore.test.js View secret
35065435 Triggered Generic Password 5f1762a public/js/stores/ProjectsStore.test.js View secret
35065434 Triggered Generic Password 5f1762a public/js/stores/ProjectsStore.test.js View secret
35065435 Triggered Generic Password 5f1762a public/js/stores/ProjectsStore.test.js View secret
35065436 Triggered Generic Password 5f1762a public/js/stores/ProjectsStore.test.js View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@riccio82 riccio82 changed the title ♻️ refactor(test): coverage tooling — phase 0 of 80% coverage roadmap ♻️ refactor(test): coverage tooling — phases 0-2 (partial) of 80% coverage roadmap Jul 17, 2026
riccio82 added 8 commits July 20, 2026 11:41
… to 80%

Add unit/RTL tests for the outsource flow (AssignToTranslator, OutsourceVendor,
OutsourceContainer and children), the projects bulk-actions flow
(ProjectsBulkActions and its Bulk* modals), and shared common UI primitives
(Dropdown, Accordion, NumericStepper, ApplicationWrapper, form rule helpers,
etc.), completing Phase 3 of the coverage improvement plan.

Coverage: outsource 8.3% -> 98.8%, projects 52.1% -> 84.8%, common 61.5% -> 81.0%.
…hase 3

Follow-up to the previous commit: `git commit -a` only stages tracked-file
changes, so these newly-added test files (untracked) were missed from that
commit. No further logic changes, same phase 3 coverage work.
…o 80%

Add unit/RTL tests for the analysis flow (AnalyzeMain, ProjectAnalyze,
AnalyzeChunksResume, AnalyzeHeader and the chunk/job analyze sub-components)
and the review-extended (LQA) flow (ReviewExtendedIssue, ReviewExtendedIssuePanel,
ReviewExtendedCategorySelector, ReviewExtendedIssuesContainer and related
sub-components), completing Phase 4 of the coverage improvement plan.

Coverage: analyze 0% -> 94.9%, review_extended 9.3% -> 94.0%.
@riccio82 riccio82 changed the title ♻️ refactor(test): coverage tooling — phases 0-2 (partial) of 80% coverage roadmap ♻️ refactor(test): coverage tooling — phases 0-4 of 80% coverage roadmap Jul 22, 2026
riccio82 added 3 commits July 22, 2026 10:19
…gn merge

SocialButtons.js switched from <img alt="..."> to inline SVG icon components
with no accessible name, so alt-text queries no longer match. Query by DOM
position/container scope instead, matching the rendered structure.
Add unit tests for custom hooks (useAuth, useOutsourceQuote, useSocketLayer,
useMediaQuery, useResizable, useCurrencyRates, useResizeObserver,
useDeviceCompatibility, UseHotKeysComponent, useContextDocument) and modal
components (SplitJob, PreferencesModal, ModifyTeam, JobMetadataModal,
ShareTmModal, ShortCutsModal, RevisionFeedbackModal, CreateTeam,
CopySourceModal, and smaller confirm/alert modals plus the shared
ModalContainer/ModalOverlay/modalRegistry plumbing), completing Phase 5 of
the coverage improvement plan.

Coverage: hooks 44.4% -> 98.1%, modals 10.0% -> 95.6%.
@riccio82 riccio82 changed the title ♻️ refactor(test): coverage tooling — phases 0-4 of 80% coverage roadmap ♻️ refactor(test): coverage tooling — phases 0-5 of 80% coverage roadmap Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant