Skip to content

fix(generator-networks-creator): normalize zero viewport dimensions#549

Closed
sk8kpwhrjt-creator wants to merge 1 commit into
apify:masterfrom
sk8kpwhrjt-creator:codex/normalize-screen-viewport-records
Closed

fix(generator-networks-creator): normalize zero viewport dimensions#549
sk8kpwhrjt-creator wants to merge 1 commit into
apify:masterfrom
sk8kpwhrjt-creator:codex/normalize-screen-viewport-records

Conversation

@sk8kpwhrjt-creator
Copy link
Copy Markdown

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 / clientHeight values 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:

  • derive innerWidth from min(screen.width, outerWidth) when the collected value is zero
  • derive innerHeight from min(availHeight, outerHeight) when the collected value is zero
  • derive clientWidth / clientHeight from the normalized inner viewport when the collected values are zero
  • keep genuinely unfixable records rejected by the schema

That 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.ts
  • pnpm exec tsc --noEmit -p tsconfig.json
  • pnpm --filter generative-bayesian-network compile && pnpm --filter generator-networks-creator compile
  • pnpm exec prettier --check packages/generator-networks-creator/src/record-schema.ts test/generator-networks-creator/record-schema.test.ts
  • git diff --check

Note: pnpm --filter generator-networks-creator build reaches TypeScript compilation, but the workspace build script then uses Unix cp, which is not available in this Windows environment. I validated the compile scripts directly instead.

Copy link
Copy Markdown
Member

@barjin barjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned under #544 , the right solution is to fix the fingerprint collection script.

Closing this PR now. Thank you for your contribution anyway!

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