Skip to content

test(encoding): cover name truncation and UID generation - #1595

Merged
skevetter merged 2 commits into
mainfrom
test/coverage-maintenance-2026-10-19
Oct 19, 2026
Merged

skevetter merged 2 commits into
mainfrom
test/coverage-maintenance-2026-10-19

Conversation

@skevetter

@skevetter skevetter commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds pkg/encoding/uid_test.go covering the untested UID and name-truncation logic in pkg/encoding/encoding.go: SafeConcatNameMax, IsLegacyUID, CreateNewUID, and CreateNewUIDShort. Test-only change.

Why

pkg/encoding was at 26.5% coverage. Only one SafeConcatNameMax case existed. Unpinned: exact-max boundary, trailing-dash cut branch, digest suffix format, collision separation, and legacy UID length boundaries. Workspace IDs depend on these lengths.

Validation

  • go test -race -count=3 ./pkg/encoding/: ok
  • Mutation check (temporary, reverted; encoding.go restored to original):
    • > changed to >= in SafeConcatNameMax: exact-max tests red
    • dash-branch forced off: suffix-format test red
    • MachineUIDLength changed to +1 in IsLegacyUID: legacy-boundary tests red
  • mise run cli:format: no changes
  • mise run cli:lint:ci: 0 issues
  • Added-diff comment scan: no comment lines

CodeRabbit CLI

coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main): completed, 0 findings, reviewed pkg/encoding/uid_test.go.

Auto-merge

Eligible: yes. Test-only, 1 file, 164 added lines.

Next

GetMachineUID and GetMachineUIDShort are not covered. They depend on platform machine-ID files and the home directory, so they were left out to keep the tests hermetic.

Summary by CodeRabbit

  • Tests
    • Added coverage for name truncation, suffix formatting, and distinguishing names with shared prefixes.
    • Added checks for UID length classification, truncation behavior, and short UID formatting.

@skevetter skevetter added the test-coverage Unit test coverage (maintenance bot) label Oct 19, 2026
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit ad11b9b
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ad6680642d6314712dba066

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit ad11b9b
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ad66807e22e00c79bc08018

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6cb98b3b-26af-4c64-b265-a2958908f40c
📥 Commits

Reviewing files that changed from the base of the PR and between 70f2d93 and ad11b9b.

📒 Files selected for processing: 1
  • pkg/encoding/uid_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📝 Walkthrough

Adds tests for SafeConcatNameMax name preservation and truncation, legacy UID length classification, and the lengths and formats returned by CreateNewUID and CreateNewUIDShort.

Changes: UID encoding tests

Layer / File(s) Summary
Name preservation and truncation
pkg/encoding/uid_test.go
Tests that SafeConcatNameMax preserves names within the limit and returns exact-length truncated names. The tests check suffix formats and distinct outputs for inputs with a shared prefix.
UID classification and creation formats
pkg/encoding/uid_test.go
Tests legacy UID classification by length. Tests also check CreateNewUID length, prefix, and suffix format, and CreateNewUIDShort output format.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to ad11b

The added UID and name-truncation tests are ready to merge after normal checks; no production behavior changes.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description explains the change, motivation, validation commands, mutation checks, and testing scope. However, it does not follow the repository template and omits the required change-type declara… Update the description to use the repository template. Add the What and why, Fixes, Type of change, AI assistance, Testing, and Checklist sections. Mark applicable checkboxes, state none for the issue reference if needed, disc…
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the test coverage added for name truncation and UID generation.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, motivation, validation commands, mutation checks, and testing scope. However, it does not follow the repository template and omits the required change-type declaration, issue reference such as Fixes #... or none, AI-assistance disclosure, checklist confirmations, and the explicit integration-test applicability statement.

Resolution

Update the description to use the repository template. Add the What and why, Fixes, Type of change, AI assistance, Testing, and Checklist sections. Mark applicable checkboxes, state none for the issue reference if needed, disclose AI assistance if used, and state why integration tests are not needed for this test-only change.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@skevetter
skevetter marked this pull request as ready for review October 19, 2026 22:13
@mergify

mergify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter

Copy link
Copy Markdown
Contributor Author

CodeRabbit CLI and GitHub reviews cover ad11b9b with 0 actionable findings and no unresolved threads. Minor warnings: this AI-assisted test-only PR follows the maintenance skill description format; no linked issue or integration behavior change applies. Descriptive Go test names follow the skill style rule without redundant docstrings. Greptile has no review, status, or review request; the maintenance skill gate is conditional on it reviewing.

@skevetter
skevetter merged commit 2a0a202 into main Oct 19, 2026
111 checks passed
@skevetter
skevetter deleted the test/coverage-maintenance-2026-10-19 branch October 19, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l test-coverage Unit test coverage (maintenance bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant