Skip to content

code simplifier: allowed_issue_fields.cjs; remove drain3_server.py#40578

Merged
pelikhan merged 6 commits into
mainfrom
copilot/aw-code-simplifier-failure-fix
Jun 21, 2026
Merged

code simplifier: allowed_issue_fields.cjs; remove drain3_server.py#40578
pelikhan merged 6 commits into
mainfrom
copilot/aw-code-simplifier-failure-fix

Conversation

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

The scheduled Code Simplifier run #27893897834 completed its edits (+50/-51) but terminated with an authentication failure before committing. This PR applies those planned simplifications manually, and additionally removes the drain3_server.py MCP server and all associated files.

allowed_issue_fields.cjs

validateAllowedIssueFields was calling validateAllowedIssueFieldName in a loop, which rebuilt new Set(allowedFields) on every iteration. Refactored to build the Set once (reusing it for both the "*" wildcard check and per-field lookups):

// before: Set rebuilt N times, once per field
for (const field of issueFields) {
  validateAllowedIssueFieldName(field.name, allowedFields); // creates Set internally
}

// after: Set built once
const allowedFieldSet = new Set(allowedFields.map(f => f.toLowerCase()));
if (allowedFieldSet.has("*")) return;
for (const field of issueFields) {
  if (!allowedFieldSet.has(field.name.toLowerCase())) throw ...;
}

drain3_server.py removal

The Python-based Drain3 FastMCP server and all associated files have been deleted:

  • Deleted drain3_server.py — the Python FastMCP server
  • Deleted test_drain3_server.py — its AST-based test harness
  • Deleted drain3.md — the shared MCP config whose setup steps existed solely to install dependencies and launch drain3_server.py
  • Updated mcp-debug.md — replaced the drain3-specific example session with a generic placeholder
  • Updated docs/guides/mcps.md — removed the Drain3 row from the pre-configured MCP server table

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code simplifier engine failure due to authentication issue code simplifier: drain3_server.py and allowed_issue_fields.cjs Jun 21, 2026
Copilot AI requested a review from pelikhan June 21, 2026 05:22
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot do the work

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot remove usage of drain3_server.py . Delete that file as well.

Copilot AI and others added 2 commits June 21, 2026 05:33
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot do the work

Done. Applied all planned simplifications:

drain3_server.py — commit code simplifier: drain3_server.py and allowed_issue_fields.cjs:

  • import re hoisted to module-level imports
  • _snapshot_error(p, snapshot) → Optional[str] helper introduced; all 8 snapshot-not-found guards across 6 tools replaced with if err := _snapshot_error(p, snapshot): yield err; return
  • _stream_clusters(path, limit, item_event) shared generator introduced; list_templates and list_clusters reduced to single-line yield from delegates

allowed_issue_fields.cjs — same commit + style fix:

  • validateAllowedIssueFields now builds allowedFieldSet once and uses it for both the "*" wildcard check and per-field lookups instead of calling validateAllowedIssueFieldName (which rebuilt the Set) on every iteration
  • All 24 existing tests pass with identical behaviour

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove usage of drain3_server.py . Delete that file as well.

Done. Removed in commit remove drain3_server.py and all usages:

  • Deleted drain3_server.py, test_drain3_server.py, and drain3.md (the shared MCP config that existed solely to install and run the Python server)
  • Updated mcp-debug.md: replaced the drain3-specific example session with a generic one
  • Updated docs/guides/mcps.md: removed the Drain3 row from the MCP server table

Copilot AI changed the title code simplifier: drain3_server.py and allowed_issue_fields.cjs code simplifier: allowed_issue_fields.cjs; remove drain3_server.py Jun 21, 2026
@pelikhan pelikhan marked this pull request as ready for review June 21, 2026 05:51
Copilot AI review requested due to automatic review settings June 21, 2026 05:51

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

This PR applies a small performance-focused refactor to the JS issue-field allowlist validator used by the Actions setup scripts, and removes the Drain3 Python FastMCP server integration (and references) from the repository’s shared MCP configurations and docs.

Changes:

  • Refactors validateAllowedIssueFields to build the allowlist Set once and reuse it (including handling "*" wildcard).
  • Deletes the Drain3 MCP server implementation and its shared MCP config/test harness.
  • Updates MCP documentation and debugging example text to remove Drain3 references.
Show a summary per file
File Description
docs/src/content/docs/guides/mcps.md Removes Drain3 from the “pre-configured MCP servers” table.
actions/setup/js/allowed_issue_fields.cjs Refactors allowlist validation to reuse a precomputed, case-insensitive set.
.github/workflows/smoke-copilot.lock.yml Updates generated workflow lock metadata hash.
.github/workflows/shared/mcp/test_drain3_server.py Removes the Drain3 server AST-based validation script.
.github/workflows/shared/mcp/drain3.md Removes the shared MCP configuration that installed/launched the Drain3 server.
.github/workflows/shared/mcp/drain3_server.py Removes the Drain3 FastMCP HTTP server implementation.
.github/workflows/shared/mcp-debug.md Replaces the Drain3-specific debug example with generic placeholders.

Copilot's findings

Tip

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

  • Files reviewed: 7/7 changed files
  • Comments generated: 4

@@ -1,4 +1,4 @@
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"6669d3fc0bdfdd7a9e54e10d8c1e41c04dc17e1d162f2e639dabdb1255ee8a78","body_hash":"3ed9a0835f964798b12a6c4c8600addbbf66518ae974a9e6ed7efefc76b0dc43","agent_id":"copilot","agent_model":"gpt-5.4","engine_versions":{"copilot":"1.0.63"}}
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"6669d3fc0bdfdd7a9e54e10d8c1e41c04dc17e1d162f2e639dabdb1255ee8a78","body_hash":"112ba8db78a4994cdc51d736f773b2b1ac912f174b6b8a98fdfb331329235d12","agent_id":"copilot","agent_model":"gpt-5.4","engine_versions":{"copilot":"1.0.63"}}
Comment on lines +55 to +61
if (!Array.isArray(allowedFields) || allowedFields.length === 0) {
return;
}
const allowedFieldSet = new Set(allowedFields.map(f => f.toLowerCase()));
if (allowedFieldSet.has("*")) {
return;
}
Comment on lines 62 to +65
for (const field of issueFields) {
validateAllowedIssueFieldName(field.name, allowedFields);
if (!allowedFieldSet.has(field.name.toLowerCase())) {
throw new Error(`${ERR_VALIDATION}: issue field "${field.name}" is not in the allowed-fields list: ${allowedFields.join(", ")}`);
}
Comment on lines +55 to +57
if (!Array.isArray(allowedFields) || allowedFields.length === 0) {
return;
}
@github-actions

Copy link
Copy Markdown
Contributor

@copilot review all comments and address unresolved review feedback.
Please summarize the remaining blockers and next step.

Generated by 👨‍🍳 PR Sous Chef · 55.7 AIC · ⌖ 1 AIC · ⊞ 17.3K ·

@github-actions

Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — great to see the Code Simplifier recovery work landing, and the allowed_issue_fields.cjs Set-hoisting refactor is a clean improvement. A couple of things worth addressing before this merges:

  • Split the PR — this bundles two distinct operations: the JS performance refactor (from the failed Code Simplifier run) and the drain3_server.py removal (added separately, per the description). These are independent changes with different risk profiles. Separating them makes it easier for reviewers to assess each in isolation and reduces the blast radius if one change needs to be reverted.
  • Add tests for the JS refactor — the allowed_issue_fields.cjs change refactors the validation loop logic. A unit test covering the wildcard "*" path and the per-field rejection path would confirm the refactor is behaviorally equivalent to the original.

If you'd like a hand, you can assign this prompt to your coding agent:

In actions/setup/js/allowed_issue_fields.cjs, the validateAllowedIssueFields function was refactored to build a Set once instead of N times.
Add unit tests (in the appropriate test file for this module) covering:
1. A call where allowedFields contains "*" — all fields should be accepted without throwing.
2. A call where a field name matches an entry in allowedFields (case-insensitive) — should not throw.
3. A call where a field name is NOT in allowedFields and "*" is not present — should throw with a descriptive error.
Ensure the tests exercise the new Set-based code path.

Generated by ✅ Contribution Check · 115.5 AIC · ⌖ 7.82 AIC · ⊞ 5.9K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

…ifier-failure-fix

# Conflicts:
#	.github/workflows/smoke-copilot.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main and recompile

Done. Merged main (resolved the smoke-copilot.lock.yml body-hash conflict by taking the main version) and recompiled — all 249 workflows compiled successfully with 0 errors.

@pelikhan pelikhan merged commit e76ef4e into main Jun 21, 2026
35 checks passed
@pelikhan pelikhan deleted the copilot/aw-code-simplifier-failure-fix branch June 21, 2026 14:28
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.

3 participants