fix(generator-networks-creator): normalize zero viewport dimensions#549
Closed
sk8kpwhrjt-creator wants to merge 1 commit into
Closed
Conversation
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.
Addresses #6.
@algora-pbc /claim #6
Summary
This fixes the zero viewport dimensions reported in #6 at the training-record preprocessing layer without dropping the affected records from the dataset.
The previous direct schema-tightening approach is technically correct for the final record shape, but reviewer feedback on a similar PR noted that rejecting zero
innerWidth/innerHeight/clientWidth/clientHeightvalues removes most of the current training snapshot. This patch keeps the stricter final schema while first normalizing zero viewport fields from the same record's surrounding screen dimensions:innerWidthfrommin(screen.width, outerWidth)when the collected value is zeroinnerHeightfrommin(availHeight, outerHeight)when the collected value is zeroclientWidth/clientHeightfrom the normalized inner viewport when the collected values are zeroThat prevents zero viewport dimensions from reaching future generated networks while preserving otherwise useful records collected from hidden/embedded contexts.
Validation
pnpm exec vitest run test/generator-networks-creator/record-schema.test.ts test/generator-networks-creator/generator-networks-creator.test.tspnpm exec tsc --noEmit -p tsconfig.jsonpnpm --filter generative-bayesian-network compile && pnpm --filter generator-networks-creator compilepnpm exec prettier --check packages/generator-networks-creator/src/record-schema.ts test/generator-networks-creator/record-schema.test.tsgit diff --checkNote:
pnpm --filter generator-networks-creator buildreaches TypeScript compilation, but the workspace build script then uses Unixcp, which is not available in this Windows environment. I validated the compile scripts directly instead.