Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b76bdebf-72b0-48e3-8f17-92d521a5e130 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors sanitizer APIs to disambiguate workflow artifact/user-agent identifiers (hyphenated) from programming-language identifiers (underscore-based), with updated call sites, docs, and tests.
Changes:
- Renamed
workflow.SanitizeIdentifiertoworkflow.SanitizeArtifactIdentifierand updated workflow renderer + tests. - Exported
stringutil.SanitizeIdentifierName(formerly private) and routed existing helpers through it. - Added unit tests and README documentation for the newly exported identifier sanitizer.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/strings.go | Renames and documents the workflow-domain sanitizer as SanitizeArtifactIdentifier. |
| pkg/workflow/mcp_renderer_github.go | Updates user-agent fallback to use SanitizeArtifactIdentifier. |
| pkg/workflow/codex_engine_test.go | Renames the workflow sanitizer test and updates assertions to the new API. |
| pkg/stringutil/sanitize.go | Exports SanitizeIdentifierName and reroutes existing sanitizers through it. |
| pkg/stringutil/sanitize_test.go | Adds dedicated tests for SanitizeIdentifierName. |
| pkg/stringutil/README.md | Documents SanitizeIdentifierName in the package README. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
pkg/workflow/strings.go:419
- There are still references to the old name
SanitizeIdentifierin repository docs/comments (e.g.,pkg/workflow/strings.go:135,196,pkg/workflow/README.md, and the linked scratchpad docs). Since this function is nowSanitizeArtifactIdentifier, these references should be updated to avoid confusing API guidance/search results.
This issue also appears on line 448 of the same file.
// SanitizeArtifactIdentifier sanitizes a workflow name to create a safe identifier
// suitable for use as a user agent string or similar context.
//
// This is a SANITIZE function (character validity pattern). Use this when creating
// identifiers that must be purely alphanumeric with hyphens, with no special characters
// preserved. Unlike SanitizeWorkflowName which preserves dots and underscores, this
pkg/workflow/strings.go:456
- The debug log messages still say "identifier" even though the exported API is now domain-specific (
SanitizeArtifactIdentifier). Consider updating the log messages to mention "artifact identifier" (and using %q for the input) to make debug output unambiguous and resilient to whitespace/newlines in names.
func SanitizeArtifactIdentifier(name string) string {
stringsLog.Printf("Sanitizing identifier: %s", name)
result := SanitizeName(name, &SanitizeOptions{
PreserveSpecialChars: []rune{},
TrimHyphens: true,
DefaultValue: "github-agentic-workflow",
})
if result != name {
stringsLog.Printf("Sanitized identifier: %s -> %s", name, result)
- Files reviewed: 6/6 changed files
- Comments generated: 3
🧪 Test Quality Sentinel ReportTest Quality Score: 90/100✅ Excellent test quality
Test Classification DetailsView All Test Classifications
Test Detail Notes
Flagged Items — Informational Only
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 90/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). Both changed tests enforce behavioral contracts with solid edge-case coverage. Minor test inflation noted in sanitize_test.go (2.9:1 ratio) but justified by meaningful table-driven edge cases.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
✅ Smoke CI completed successfully! |
This issue identified ambiguous sanitizer naming across
pkg/workflowandpkg/stringutil, where similarly named functions serve different domains (hyphenated artifact/user-agent IDs vs underscore-based programming identifiers). This change clarifies those boundaries with explicit API names and docs.Workflow sanitizer naming made domain-explicit
workflow.SanitizeIdentifiertoworkflow.SanitizeArtifactIdentifier.Stringutil identifier sanitizer promoted and documented
stringutil.sanitizeIdentifierNameasstringutil.SanitizeIdentifierName.SanitizeParameterNameandSanitizePythonVariableNameby routing them through the exported helper.Focused test updates
stringutil.SanitizeIdentifierNameto lock in underscore behavior, numeric-prefix handling, and optional extra allowed characters.