fix: detect content drift in generated webiny package during validation - #5476
Draft
adrians5j wants to merge 2 commits into
Draft
fix: detect content drift in generated webiny package during validation#5476adrians5j wants to merge 2 commits into
adrians5j wants to merge 2 commits into
Conversation
The `validate-webiny-package` command only compared file paths and an inputs hash computed from source `src/exports` folders. Hand-edits made directly inside the generated `webiny` package (e.g. adding exports to an existing generated file instead of a source package's `src/exports` folder) changed neither the paths nor the hash, so validation passed — only for the edits to be silently wiped on the next generation. Add a whitespace-normalized content comparison of each expected file against its on-disk counterpart. Normalization absorbs oxfmt line-wrapping (committed files are formatted; generation output is raw) while still catching any added, removed, or renamed export and any changed module path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
adrians5j
marked this pull request as draft
August 4, 2026 14:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
validate-webiny-packagesaid "The `webiny` package is up to date" even when export code had been added directly into the generatedwebinypackage, instead of following the sourcesrc/exportsfolder convention (e.g.packages/app-admin/src/exports/*.ts).Root cause — the validation only ever checked two things:
packages/*/src/exports/**/*.ts),@webiny/iconssrc, andsrc-static. Nothing from the generatedwebiny/srcoutput feeds the hash, so hand-editing generated files can't move it.So a hand-edit that added exports into an already-expected generated file changed neither the hash nor any path. Validation passed. The next
generate-webiny-packagerun then rebuilt from source and silently wiped those edits.Fix
Add a content comparison of each expected file against its on-disk counterpart in the deep check.
Comparison is whitespace-normalized (
\s+→ single space, trimmed): committed files areoxfmt-formatted (multi-line, wrapped at print width) whilecomputeGenerationResult()returns raw, unformatted merge output. Normalizing absorbs that cosmetic difference while still catching any added / removed / renamed export or changed module path — exactly the hand-edit class that previously slipped through.Verification
webiny/srcadmin.ts (content drift)→ exit 1Known remaining blind spots (not addressed here)
.tsxfiles insrc/exportsare silently skipped (ScanExportsFoldersService.ts.ts-only filter).packages/*are scanned — rootextensions/is never seen.🤖 Generated with Claude Code