Skip to content

chore(scripts): rename ticket-prefixed scripts + enforce naming convention#179

Merged
mrdailey99 merged 3 commits into
developfrom
chore/script-naming-cleanup
May 15, 2026
Merged

chore(scripts): rename ticket-prefixed scripts + enforce naming convention#179
mrdailey99 merged 3 commits into
developfrom
chore/script-naming-cleanup

Conversation

@mrdailey99
Copy link
Copy Markdown
Collaborator

Summary

  • Rename three ticket-prefixed scripts to behaviour-based names so the repo isn't anchored to internal Jira IDs.
  • Scrub the customer-facing PDX-479 reference from the STEPS_REQUIRED error message returned by provar_testcase_generate — that message reaches the MCP client and is read by the LLM and end users.
  • Add scripts/lint-script-names.cjs as a wireit-wired lint dependency that fails the build if any file under scripts/ matches ^pdx[-_]?\d+ (case-insensitive). Document the convention in CLAUDE.md so future contributors and agents see it.

Renames (git mv — history preserved)

Before After
scripts/pdx-481-trace.cjs scripts/authoring-flow-trace.cjs
scripts/pdx-481-validate.cjs scripts/authoring-guidance-validate.cjs
scripts/pdx-482-validate.cjs scripts/construction-contract-validate.cjs

Each renamed script's internal references updated: header comment, clientInfo.name, and console.log output strings.

Error message change

src/mcp/tools/testCaseGenerate.ts STEPS_REQUIRED:

  • Before: This produces a contract-violating skeleton (the PDX-479 regression pattern) and is rejected.
  • After: Constructing a test case requires the full step tree in a single call; an empty payload on the write path would produce a skeleton-only file.

The details.suggestion field is unchanged — it never referenced a ticket — so all existing assertions (construction-contract-validate.cjs 28/28, unit tests STEPS_REQUIRED block) continue to pass.

Enforcement

scripts/lint-script-names.cjs exits non-zero with a clear remediation message when any scripts/pdx-NNN-* file exists. Wired into yarn lint via wireit:

"lint": { "dependencies": ["lint:script-names"], ... }
"lint:script-names": { "command": "node scripts/lint-script-names.cjs", ... }

Negative-tested by temporarily dropping a pdx-999-fake-test.cjs into scripts/ — the check failed with exit 1 and printed the offender plus a rename hint.

Test plan

  • yarn compile — clean
  • node_modules/.bin/nyc node_modules/.bin/mocha "test/**/*.test.ts" — 1136 passing (no change vs baseline; STEPS_REQUIRED tests assert on details.suggestion which I didn't touch)
  • yarn lint — clean (runs lint:script-names first, then ESLint)
  • node scripts/construction-contract-validate.cjs — 28/28 PASS via the new filename
  • Negative-test: touch scripts/pdx-999-fake-test.cjs && node scripts/lint-script-names.cjs → exit 1 with offender listed

Why PDX-0

This is a chore/cleanup that doesn't change any product behaviour or fix a specific ticket. The renames are mechanical and the enforcement script is preventive — it stops the convention from drifting back.

Notes for reviewers

  • Source-code comments in src/ and test/ still contain PDX-XXX references in dev-facing places (test block headers, internal regression-guard comments). Those are intentional and aligned with the existing memory rule that source comments and PR descriptions are the right place for ticket IDs. This PR only touches surfaces that customers / LLMs see (error message bodies + script filenames + CI log strings).
  • Pre-existing PDX-479 references in docs/mcp-pilot-guide.md Scenario 12 background remain untouched — flagging as a possible follow-up sweep if desired.

🤖 Generated with Claude Code

…enforcement lint

RCA: Three scripts under scripts/ were named after the tickets that introduced them (pdx-481-trace.cjs, pdx-481-validate.cjs, pdx-482-validate.cjs). Ticket-prefixed filenames anchor the repo to internal Jira IDs, age poorly once the ticket closes, and surface in customer-visible artifacts (CI logs, PR diffs, repo browsing). The provar_testcase_generate STEPS_REQUIRED error message also referenced PDX-479 in the message body returned to the MCP client, leaking internal nomenclature into a customer-facing surface.
Fix: Renamed pdx-481-trace.cjs -> authoring-flow-trace.cjs, pdx-481-validate.cjs -> authoring-guidance-validate.cjs, pdx-482-validate.cjs -> construction-contract-validate.cjs (git mv preserves history). Updated each script's header comment, internal clientInfo identifiers, log strings, and console.log output to drop PDX-XXX references. Reworded the STEPS_REQUIRED error message in testCaseGenerate.ts to describe the contract violation in behavioural terms ("Constructing a test case requires the full step tree in a single call") instead of citing a ticket. Added scripts/lint-script-names.cjs which fails the lint chain if any file under scripts/ matches ^pdx[-_]?\d+ (case-insensitive); wired into wireit as a dependency of yarn lint. Documented the convention in CLAUDE.md.
Copilot AI review requested due to automatic review settings May 15, 2026 16:42
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

Quality Orchestrator

🟢 LOW · 2 / 100 · All changed files have mapped tests.


🧪 Tests to Run · Running 1 of 51 tests

  • unit/mcp/testCaseGenerate.test.ts
▶ Run command
npx vitest run \
  unit/mcp/testCaseGenerate.test.ts

⚡ quality-orchestrator  ·  /qo stub <file>  ·  qo analyze-local

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes ticket-ID anchoring from script filenames and customer/LLM-facing messaging, and adds a lint gate to prevent reintroducing ticket-prefixed script names.

Changes:

  • Renames three scripts/pdx-* utilities to behavior-based names and updates their internal identifiers/log strings.
  • Updates the provar_testcase_generate STEPS_REQUIRED error message to remove the customer-facing PDX-479 reference.
  • Adds a wireit-wired script-name lint (lint:script-names) and documents the naming convention in CLAUDE.md.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/mcp/tools/testCaseGenerate.ts Scrubs ticket reference from STEPS_REQUIRED runtime-guard error message.
scripts/mcp-smoke.cjs Updates smoke-test copy/paths and references to renamed validation script.
scripts/lint-script-names.cjs Introduces a lint script to reject ticket-prefixed script filenames.
scripts/construction-contract-validate.cjs Renamed + updated identifiers/messages to behavior-based naming.
scripts/authoring-guidance-validate.cjs Renamed + updated identifiers/messages to behavior-based naming.
scripts/authoring-flow-trace.cjs Renamed + updated identifiers/messages to behavior-based naming.
package.json Wires lint:script-names into yarn lint via wireit.
CLAUDE.md Documents the new script naming convention and enforcement mechanism.

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

Comment thread scripts/lint-script-names.cjs Outdated
Comment on lines +25 to +29
const offenders = fs
.readdirSync(SCRIPTS_DIR, { withFileTypes: true })
.filter((e) => e.isFile())
.map((e) => e.name)
.filter((name) => TICKET_PREFIX_RE.test(name))
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 82de452 — now recurses into subdirectories. Verified with three states: clean (exit 0), (exit 1, top-level), (exit 1, reports the full nested path). CLAUDE.md updated to call out nested coverage explicitly.

Comment thread package.json Outdated
"command": "node scripts/lint-script-names.cjs",
"files": [
"scripts/lint-script-names.cjs",
"scripts/*"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 82de452 — wireit files glob is now scripts/**/*. Cache invalidation now triggers on changes anywhere under scripts/, matching the recursive walk in the lint check.

…view

RCA: Copilot review on PR #179 flagged two related gaps. (1) scripts/lint-script-names.cjs used readdirSync without recursion, so a future scripts/tmp/pdx-NNN.cjs nested file would bypass the rule despite the documentation saying "under scripts/". (2) The wireit `files` glob for `lint:script-names` was `scripts/*`, which excludes subdirectories, so wireit's cache would not invalidate on changes to nested files even if the check itself were recursive.
Fix: Rewrote the offender walk as a recursive `walk(dir)` that traverses subdirectories and reports relative paths from `scripts/`. Updated the wireit `files` glob to `scripts/**/*` so cache invalidation covers nested additions. Tightened CLAUDE.md wording to call out "anywhere under scripts/ (including nested subdirectories)" and gave a nested-path example in the rejected list. Validated three states: clean (exit 0), top-level offender (exit 1), nested offender (exit 1 reporting the full nested path).
… after PR #177 landed

RCA: PR #177 (PDX-484 tool-title hardening) landed on develop while this cleanup branch was open. Both branches modified scripts/pdx-482-validate.cjs — this branch renamed it to scripts/construction-contract-validate.cjs and scrubbed its PDX-XXX header references, while PR #177 added a titleAssertions() helper and rewrote the header on the old filename. Git auto-merged the title-assertion content into the renamed file (rename detection worked) but conflicted on the header comment block.
Fix: Kept the clean header from this branch (no PDX-XXX refs) and merged in the new title-contract-pass paragraph reworded without the PDX-484 prefix ("Title-contract pass:" instead of "PDX-484 — title contract"). Also scrubbed the "(PDX-484)" suffixes from titleAssertions() assertion labels and the "PDX-484:" prefix from the two comment lines that call titleAssertions(toolList, record) — keeping the script free of ticket IDs to match the convention. src/mcp/tools/testCaseGenerate.ts auto-merged cleanly: the STEPS_REQUIRED error-message scrub from this branch and the title field addition from PDX-484 coexist. Verified: yarn compile clean, yarn lint clean (includes lint:script-names), 1140 unit tests pass, construction-contract-validate.cjs 40/40 PASS (12 new title-contract assertions now exercised against the merged tool).
@mrdailey99 mrdailey99 merged commit f3284f5 into develop May 15, 2026
4 checks passed
@mrdailey99 mrdailey99 deleted the chore/script-naming-cleanup branch May 15, 2026 17:15
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.

2 participants