Skip to content

[jsweep] Clean validate_memory_files.cjs#48126

Merged
pelikhan merged 1 commit into
mainfrom
signed/jsweep/validate-memory-files-3269a453cc05976e
Jul 26, 2026
Merged

[jsweep] Clean validate_memory_files.cjs#48126
pelikhan merged 1 commit into
mainfrom
signed/jsweep/validate-memory-files-3269a453cc05976e

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Cleaned validate_memory_files.cjs — fixed the test file module pattern and improved test coverage.

Context

Execution context: github-script (uses core as a global from the github-script runtime)

Changes

Test file: validate_memory_files.test.cjs

  1. Fixed ESM/CJS module loading pattern — replaced bare require("./validate_memory_files.cjs") with createRequire(import.meta.url)("./validate_memory_files.cjs") to match the established pattern used across the codebase (e.g. issue_title_dedup.test.cjs). The previous pattern mixed ESM import with a bare CJS require() call, which is inconsistent.

  2. Improved test coverage for core.info calls — added 3 new tests:

    • Asserts core.info is called with the correct message when allowedExtensions is not provided (allow-all branch)
    • Asserts core.info is called with the correct message when allowedExtensions is an empty array (allow-all branch)
    • Asserts core.info is called when the memory directory does not exist

    These tests verify the previously untested core.info call paths in the allow-all and missing-directory branches.

Test Improvements

  • Tests before: 30
  • Tests after: 33 (+3 new tests)
  • All new tests cover previously untested core.info call paths

Validation

✅ All checks passed:

  • Formatting: npm run format:cjs
  • Linting: npm run lint:cjs
  • Type checking: npm run typecheck
  • Tests: npm run test:js ✓ (33/33 tests pass for this file)

Generated by 🧹 jsweep - JavaScript Unbloater · ⌖ 9.05 AIC ·

  • expires on Jul 27, 2026, 8:59 PM UTC-08:00

…ry_files

- Fix ESM/CJS mismatch: replace bare require() with createRequire(import.meta.url)
  to match the established test pattern used across the codebase
- Add test asserting core.info is called on the 'allow all' branch (no allowedExtensions)
- Add test asserting core.info is called on the 'allow all' branch (empty allowedExtensions)
- Add test asserting core.info is called when memory directory does not exist

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@pelikhan
pelikhan marked this pull request as ready for review July 26, 2026 08:37
Copilot AI review requested due to automatic review settings July 26, 2026 08:37
@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #48126 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Test Quality Sentinel completed test quality analysis.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the memory-file validator tests to use the established CJS loading pattern and verify informational logging paths.

Changes:

  • Loads the CJS module through createRequire.
  • Tests allow-all and missing-directory core.info messages.
Show a summary per file
File Description
actions/setup/js/validate_memory_files.test.cjs Modernizes module loading and expands logging assertions.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Medium

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look correct:

  • createRequire(import.meta.url) fix is consistent with the established codebase pattern.
  • All 3 new tests accurately cover the previously untested core.info call paths and match the source logic.

No issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 12.3 AIC · ⌖ 5.59 AIC · ⊞ 5K

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd — this PR is a clean test-only improvement that is ready to merge.

📋 Key Themes & Highlights

Positive Highlights

  • ESM/CJS interop fixcreateRequire(import.meta.url) is the correct pattern and matches the established codebase convention
  • Branch coverage — the three new tests target previously untested core.info call paths: allow-all (no allowedExtensions), allow-all (empty array), and non-existent directory
  • Test naming — names read as specifications and clearly communicate intent
  • ✅ All validation checks pass (format, lint, typecheck, 33/33 tests)

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 15.4 AIC · ⌖ 4.51 AIC · ⊞ 6.7K
Comment /matt to run again

@github-actions github-actions Bot mentioned this pull request Jul 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, correct PR. No blocking issues.

Review summary

ESM/CJS module fix

Replacing bare require() with createRequire(import.meta.url)(...) on line 10 is correct — require is not available as a global in ESM contexts, and createRequire is the established pattern across this codebase (e.g. action_input_utils.test.cjs, allowed_issue_fields.test.cjs). This is the substantive fix.

New tests

The three added tests cover previously untested core.info call paths:

  • Allow-all branch when allowedExtensions is undefined (line 43–46)
  • Allow-all branch when allowedExtensions is [] (line 48–51)
  • Missing-directory branch with a non-empty extension list (line 60–64)

All three correctly match the source behavior in validate_memory_files.cjs. The vi.resetAllMocks() in beforeEach ensures mock isolation between tests.

Minor observation (non-blocking)

The new tests at lines 43–46 and 48–51 only assert on core.info and do not assert return values. Return value coverage is already provided by adjacent tests, so this is acceptable.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 · 27.8 AIC · ⌖ 6.16 AIC · ⊞ 5.7K
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100 — Excellent

Analyzed 3 test(s): 3 design, 0 implementation, 0 violation(s).

📊 Metrics (3 tests)
Metric Value
Analyzed 3 (Go: 0, JS: 3)
✅ Design 3 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 3 (100%)
Duplicate clusters 0
Inflation No
🚨 Violations 0
Test File Classification Notes
calls core.info when allowedExtensions is not provided validate_memory_files.test.cjs:43 behavioral_contract Verifies logging for default behavior; proper expect().toHaveBeenCalledWith()
calls core.info when allowedExtensions is empty array validate_memory_files.test.cjs:48 behavioral_contract Tests edge case with different memoryType; complements line 211-219 test
calls core.info when directory does not exist validate_memory_files.test.cjs:60 behavioral_contract Tests logging side effect for missing directory; supplements line 53-58 test

Verdict

Passed. 0% implementation tests (threshold: 30%). All tests verify behavioral contracts and logging side effects. Import refactoring (createRequire) is clean and necessary for ES module compatibility. No violations detected.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 10.6 AIC · ⌖ 7.44 AIC · ⊞ 8.1K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Test Quality Sentinel: 100/100. 0% implementation tests (threshold: 30%). All tests verify behavioral contracts and logging side effects. No violations detected.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, verify the branch is ready for merge, and summarize any remaining blockers before handing back to maintainers.

This PR looks close to done:

  • checks are green on the latest run
  • recent reviews are positive
  • please confirm nothing else needs follow-up, then report back succinctly.

Generated by 👨🍳 PR Sous Chef · gpt54 ·
Comment /souschef to run again

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 21.7 AIC · ⌖ 8.89 AIC · ⊞ 7.1K ·
Comment /souschef to run again

@pelikhan
pelikhan merged commit 4c58de3 into main Jul 26, 2026
52 of 61 checks passed
Copilot stopped work on behalf of gh-aw-bot due to an error July 26, 2026 09:35
Copilot AI requested a review from gh-aw-bot July 26, 2026 09:35
@github-actions

Copy link
Copy Markdown
Contributor Author

Great work on the test improvements! 🧪 This PR looks ready for review:

Module pattern fix — Updated the ESM/CJS require pattern to match the established codebase convention (createRequire(import.meta.url)), improving consistency.

Test coverage — Added 3 targeted tests covering previously untested core.info call paths:

  • Allow-all branch when allowedExtensions is not provided
  • Allow-all branch when allowedExtensions is an empty array
  • Missing directory case with core.info verification

Validation — All formatting, linting, type checking, and tests pass (33/33).

This PR is focused, well-documented, and ready to move forward.

Generated by ✅ Contribution Check · sonnet46 · 61.7 AIC · ⌖ 10.4 AIC · ⊞ 6.2K ·

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.

3 participants