Skip to content

test(skills): add Hypothesis property tests for PowerPoint modules#1046

Merged
WilliamBerryiii merged 9 commits intomainfrom
test/hypothesis-property-tests-powerpoint
Mar 19, 2026
Merged

test(skills): add Hypothesis property tests for PowerPoint modules#1046
WilliamBerryiii merged 9 commits intomainfrom
test/hypothesis-property-tests-powerpoint

Conversation

@WilliamBerryiii
Copy link
Copy Markdown
Member

Description

Added Hypothesis property-based testing to the PowerPoint skill, covering four core modules with 18 property tests. A shared strategies module and CI/dev Hypothesis profiles provide the testing infrastructure. Property testing uncovered a numeric sort bug in discover_images, which was fixed in this PR.

Property-Based Tests

Eighteen property tests exercised invariants, round-trip behavior, boundary conditions, and idempotency across four production modules.

  • Added test_fuzz_pptx_colors.py with six tests: resolve_color always-returns-dict, contains-rgb-or-theme, hex-idempotent; hex_brightness result 0–255; rgb_to_hex output format; and color round-trip preserving color type through shape fill.
  • Added test_fuzz_pptx_tables.py with four tests: table round-trip preserving row count, column count, and cell text through add/extract; merge boundary raising IndexError for out-of-bounds spans.
  • Added test_fuzz_build_deck.py with three tests: discover_slides output-sorted and only-matching-dirs invariants; get_slide_layout always-returns-layout for arbitrary names.
  • Added test_fuzz_validate_slides.py with five tests: discover_images output-is-sorted and all-paths-match-pattern; max_severity ordering-monotonic, empty-returns-none, and result-in-valid-set.

Shared Test Infrastructure

  • Added strategies.py with reusable Hypothesis strategies for hex colors, theme references, table elements, positions, issues, and severity results. The table_element composite strategy restricts text to XML-safe Unicode categories.
  • Updated conftest.py with ci and dev Hypothesis profiles (200 vs 50 max_examples, derandomize in CI, suppressed too_slow health check), plus make_blank_presentation() and make_blank_slide() helper functions as plain functions for use inside @given-decorated tests.

Bug Fix

  • Fixed discover_images in validate_slides.py to sort by numeric slide number instead of lexicographic filesystem order. Previous behavior sorted slide-10 before slide-2.

Configuration

  • Added hypothesis>=6.100 dev dependency and hypothesis pytest marker to pyproject.toml.
  • Configured [tool.coverage.run] source=["scripts"] and [tool.coverage.report] fail_under=85 with show_missing.
  • Added **/.hypothesis/ to .gitignore for Hypothesis example database directories.

Related Issue(s)

Closes #1013

Type of Change

Select all that apply:

Code & Documentation:

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Infrastructure & Configuration:

  • GitHub Actions workflow
  • Linting configuration (markdown, PowerShell, etc.)
  • Security configuration
  • DevContainer configuration
  • Dependency update

AI Artifacts:

  • Reviewed contribution with prompt-builder agent and addressed all feedback
  • Copilot instructions (.github/instructions/*.instructions.md)
  • Copilot prompt (.github/prompts/*.prompt.md)
  • Copilot agent (.github/agents/*.agent.md)
  • Copilot skill (.github/skills/*/SKILL.md)

Note for AI Artifact Contributors:

  • Agents: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation agents likely already exist. Review .github/agents/ before creating new ones.
  • Skills: Must include both bash and PowerShell scripts. See Skills.
  • Model Versions: Only contributions targeting the latest Anthropic and OpenAI models will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected.
  • See Agents Not Accepted and Model Version Requirements.

Other:

  • Script/automation (.ps1, .sh, .py)
  • Other (please describe):

Sample Prompts (for AI Artifact Contributions)

Testing

  • 587 tests passed after merging with origin/main (up from 549 on the base branch).
  • 18 new Hypothesis property tests verified invariants, round-trip behavior, boundary conditions, and idempotency across pptx_colors, pptx_tables, build_deck, and validate_slides.
  • Coverage measured at 90%, exceeding the 85% fail_under threshold.
  • Ruff linting passed with no issues.

Checklist

Required Checks

  • Documentation is updated (if applicable)
  • Files follow existing naming conventions
  • Changes are backwards compatible (if applicable)
  • Tests added for new functionality (if applicable)

AI Artifact Contributions

  • Used /prompt-analyze to review contribution
  • Addressed all feedback from prompt-builder review
  • Verified contribution follows common standards and type-specific requirements

Required Automated Checks

The following validation commands must pass before merging:

  • Markdown linting: npm run lint:md
  • Spell checking: npm run spell-check
  • Frontmatter validation: npm run lint:frontmatter
  • Skill structure validation: npm run validate:skills
  • Link validation: npm run lint:md-links
  • PowerShell analysis: npm run lint:ps
  • Plugin freshness: npm run plugin:generate

Security Considerations

  • This PR does not contain any sensitive or NDA information
  • Any new dependencies have been reviewed for security issues
  • Security-related scripts follow the principle of least privilege

Additional Notes

  • The hypothesis package (6.151.9) is a well-established property-based testing library with no known security vulnerabilities. Its only transitive dependency is sortedcontainers.
  • Hypothesis profiles are automatically selected based on the CI environment variable, with the ci profile using derandomized inputs and no persistent database.
  • The discover_images bug fix addressed a numeric vs. lexicographic sort issue that would have caused incorrect slide ordering for decks with 10+ slides.

@WilliamBerryiii WilliamBerryiii requested a review from a team as a code owner March 15, 2026 02:38
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 15, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

.github/skills/experimental/powerpoint/uv.lock

PackageVersionLicenseIssue Type
hypothesis6.151.9NullUnknown License
Allowed Licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, 0BSD, BlueOak-1.0.0, CC0-1.0, Unlicense, CC-BY-4.0, CC-BY-3.0, PSF-2.0, Python-2.0

OpenSSF Scorecard

PackageVersionScoreDetails
pip/hypothesis 6.151.9 UnknownUnknown
pip/sortedcontainers 2.4.0 UnknownUnknown
npm/flatted 3.4.2 🟢 4.3
Details
CheckScoreReason
Code-Review⚠️ 0Found 1/14 approved changesets -- score normalized to 0
Maintained🟢 1024 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Security-Policy🟢 4security policy file detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST⚠️ 2SAST tool is not run on all commits -- score normalized to 2

Scanned Files

  • .github/skills/experimental/powerpoint/uv.lock
  • package-lock.json

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (89d24b1) to head (9c482e1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1046      +/-   ##
==========================================
+ Coverage   88.12%   88.13%   +0.01%     
==========================================
  Files          45       45              
  Lines        7931     7932       +1     
==========================================
+ Hits         6989     6991       +2     
+ Misses        942      941       -1     
Flag Coverage Δ
pester 86.91% <ø> (ø)
pytest 90.76% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...experimental/powerpoint/scripts/validate_slides.py 99.12% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .github/skills/experimental/powerpoint/tests/strategies.py Outdated
Comment thread .github/skills/experimental/powerpoint/tests/test_fuzz_pptx_colors.py Outdated
Comment thread .github/skills/experimental/powerpoint/tests/conftest.py Outdated
Comment thread .github/skills/experimental/powerpoint/tests/test_fuzz_pptx_colors.py Outdated
@WilliamBerryiii WilliamBerryiii requested a review from auyidi1 March 17, 2026 02:11
Comment thread .github/skills/experimental/powerpoint/tests/strategies.py
Comment thread .github/skills/experimental/powerpoint/tests/test_fuzz_validate_slides.py Outdated
Comment thread .github/skills/experimental/powerpoint/tests/test_fuzz_validate_slides.py Outdated
WilliamBerryiii and others added 7 commits March 18, 2026 16:06
- add hypothesis>=6.100 dev dependency with CI/dev profiles
- create shared strategies and 18 property tests across four modules
- fix discover_images numeric sort bug found via property testing
- add .hypothesis/ to root .gitignore

🧪 - Generated by Copilot
- configure [tool.coverage.run] source to scripts/
- set fail_under=85 with show_missing in [tool.coverage.report]

📊 - Generated by Copilot
- expand E501 long lines in test_build_deck.py
- apply ruff format to strategies.py

🎨 - Generated by Copilot
- resolve CodeQL empty-except finding in test_fuzz_validate_slides.py

🔧 - Generated by Copilot
- Derive THEME_NAMES from THEME_COLOR_MAP instead of hardcoding
- Strengthen color round-trip assertion to exact hex comparison
- Move MSO_SHAPE and Inches imports to module level
- Refactor conftest to eliminate blank_presentation duplication
- add missing copyright headers to all new test and strategy files
- strengthen test_ordering_monotonic to parametrize injected severity
- cap max_examples=50 on test_apply_extract_preserves_color_type
- rename test_empty_returns_none to test_empty_returns_none_string

🔧 - Generated by Copilot
@WilliamBerryiii WilliamBerryiii force-pushed the test/hypothesis-property-tests-powerpoint branch from b4f5f1b to 3df86b1 Compare March 18, 2026 23:36
@WilliamBerryiii
Copy link
Copy Markdown
Member Author

npm audit fix: flatted 3.4.1 → 3.4.2

npm audit flagged a high-severity Prototype Pollution vulnerability in flatted <=3.4.1 (GHSA-rf6f-7fwh-wjgh).

Dependency chain: [email protected][email protected]

Fix: Bumped flatted to 3.4.2 via npm audit fix. Only package-lock.json changed (3 insertions, 3 deletions). npm audit now reports 0 vulnerabilities and cspell spell-check passes cleanly.

Commit: 9c482e1cfix(build): bump flatted 3.4.1 to 3.4.2 for prototype pollution fix

@WilliamBerryiii WilliamBerryiii merged commit 3739963 into main Mar 19, 2026
30 checks passed
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.

feat(powerpoint): add Hypothesis property tests for priority modules

4 participants