Skip to content

Conversation

Copy link

Copilot AI commented Oct 7, 2025

  • Analyze upstream PR Add version/effect dropdowns and dynamic title to Matrix Mode UI #66 structure and changes
  • Cherry-pick WebGPU bloom pass dimension enforcement fix
  • Cherry-pick mirror pass timing fixes (performance.now vs Date.now)
  • Cherry-pick mirror pass coordinate fixes (getBoundingClientRect)
  • Cherry-pick REGL array uniform workaround
  • Add canvas parameter to context objects
  • Format code with Prettier
  • Manual validation of Matrix effect
  • Test default Matrix version
  • Test mirror effect
  • Test 3D volumetric version
  • Create PR preview deployment workflow
  • Fix workflow authentication and git configuration issues
  • Improve workflow robustness and error handling

Summary

Cherry-picked critical bug fixes from upstream PR #66 (Rezmason#66) while maintaining compatibility with the static web app architecture, and added automated PR preview deployment infrastructure.

Changes Applied

WebGPU Bloom Pass (js/webgpu/bloomPass.js)

  • Enforce minimum dimensions of 1 pixel to prevent zero-sized textures
  • Added Math.max(1, ...) to pyramid texture creation and dispatch sizes
  • Prevents WebGPU errors when bloom size is very small

Mirror Pass - Both Renderers (js/webgpu/mirrorPass.js, js/regl/mirrorPass.js)

  • Changed from Date.now() to performance.now() for more accurate timing
  • Fixed click coordinate calculations using getBoundingClientRect() instead of direct client dimensions
  • Moved touch/click handlers inside the effect function scope for proper canvas binding
  • Changed from window.onclick to canvas.onmousedown for better event handling

REGL-specific Fix (js/regl/mirrorPass.js)

  • Worked around REGL array uniform bug by passing individual array elements as separate uniforms
  • Changed from clicks: () => clicks to ["clicks[0]"]: () => clicks[0] pattern

Context Updates (js/webgpu/main.js, js/regl/main.js)

  • Added canvas parameter to context objects to support mirror pass canvas event binding

PR Preview Deployment

  • Added GitHub Actions workflow for automatic PR preview deployments
  • PRs will be deployed to https://ap0ught.github.io/matrix/pr-{number}/
  • Automated comments on PRs with test links
  • Documentation in .github/PR_PREVIEW.md
  • Fixed authentication issues in workflow with proper GitHub token configuration
  • Added git remote configuration for new gh-pages branch initialization
  • Improved gh-pages initialization and deployment robustness

Workflow Improvements (Latest)

Enhanced the PR preview workflow with better error handling:

  • Check for .git directory to properly detect gh-pages checkout status
  • Clean initialization when gh-pages branch doesn't exist
  • Proper git configuration for both new and existing gh-pages branches
  • Better remote URL handling with fallback
  • Conditional commit and push (only when there are actual changes)
  • Use commit SHA instead of branch ref for more reliable checkout
  • Increased fetch-depth for gh-pages to get full history

Testing

✅ Default Matrix effect renders correctly
✅ Mirror effect works with improved mouse handling
✅ 3D volumetric mode functions properly
✅ No JavaScript errors in console
✅ All code formatted with Prettier
✅ Workflow YAML validated

Original prompt

This section details on the original issue you should resolve

<issue_title>merge upstream pr into this repo</issue_title>
<issue_description>Rezmason#66</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #39

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Merge upstream pull request into this repository Cherry-pick critical bug fixes from upstream PR #66 Oct 7, 2025
Copilot AI requested a review from ap0ught October 7, 2025 15:13
Copilot finished work on behalf of ap0ught October 7, 2025 15:13
@ap0ught ap0ught marked this pull request as ready for review October 7, 2025 15:33
Copilot AI review requested due to automatic review settings October 7, 2025 15:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR cherry-picks critical bug fixes from upstream PR #66 while maintaining the fork's static web app architecture. The changes focus on fixing WebGPU texture dimension safety, improving animation timing precision, and correcting mouse event handling in mirror effects.

Key Changes

  • Fixed potential WebGPU crashes by enforcing minimum texture dimensions in bloom passes
  • Replaced Date.now() with performance.now() for more accurate animation timing
  • Corrected mouse click coordinate calculations to account for canvas positioning

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
js/webgpu/mirrorPass.js Moved event handlers inside effect scope, fixed click coordinates, and improved timing precision
js/webgpu/main.js Added canvas parameter to mirror pass context
js/webgpu/bloomPass.js Added safety checks to prevent zero-sized textures and dispatch dimensions
js/regl/mirrorPass.js Fixed REGL array uniform bug, corrected click coordinates, and improved timing
js/regl/main.js Added canvas parameter to REGL context

@ap0ught
Copy link
Owner

ap0ught commented Oct 7, 2025

@copilot how can I test this out on https://ap0ught.github.io/matrix without deploying to master

Copy link
Author

Copilot AI commented Oct 7, 2025

@copilot how can I test this out on https://ap0ught.github.io/matrix without deploying to master

You can test this PR branch on GitHub Pages in several ways:

Option 1: Use a branch-specific URL (if gh-pages is deployed from branches)
If GitHub Pages is configured to deploy from branches, you could access:
https://ap0ught.github.io/matrix/copilot/merge-upstream-pr-66/

However, this repository appears to deploy from the master branch only.

Option 2: Create a temporary deployment workflow
I can create a GitHub Actions workflow that deploys this PR branch to a separate path like /pr-66/ on GitHub Pages. This would allow you to test at:
https://ap0ught.github.io/matrix/pr-66/

Option 3: Local testing (recommended)
Since this is a static web app with no build step, you can easily test locally:

git fetch origin copilot/merge-upstream-pr-66
git checkout copilot/merge-upstream-pr-66
python3 -m http.server 8000
# Open http://localhost:8000/?suppressWarnings=true

Option 4: Use GitHub Codespaces or Gitpod
Open this branch in a cloud IDE that provides a live preview URL.

Option 5: Deploy to Netlify/Vercel preview
These services can automatically deploy PR previews.

Which approach would you prefer? I can implement Option 2 if you'd like automated PR preview deployments.

Copilot finished work on behalf of ap0ught October 7, 2025 15:53
@ap0ught
Copy link
Owner

ap0ught commented Oct 7, 2025

@copilot ### implement Option 2
Option 2: Create a temporary deployment workflow
I can create a GitHub Actions workflow that deploys this PR branch to a separate path like /pr-66/ on GitHub Pages. This would allow you to test at:
https://ap0ught.github.io/matrix/pr-66/

Copy link
Author

Copilot AI commented Oct 7, 2025

@copilot ### implement Option 2
Option 2: Create a temporary deployment workflow
I can create a GitHub Actions workflow that deploys this PR branch to a separate path like /pr-66/ on GitHub Pages. T...

I've implemented the PR preview deployment workflow in commit 7a41e2d.

What Was Added

.github/workflows/pr-preview.yml - Automated deployment workflow that:

  • Deploys this PR branch to https://ap0ught.github.io/matrix/pr-66/
  • Automatically updates when you push new commits
  • Posts a comment on the PR with test links
  • Can be manually triggered from the Actions tab

.github/PR_PREVIEW.md - Documentation explaining how the preview system works

How to Test

The workflow will automatically run when this PR is updated. You can also manually trigger it:

  1. Go to Actions tab → PR Preview Deployment
  2. Click Run workflow
  3. Select branch: copilot/merge-upstream-pr-66
  4. Click Run workflow

After deployment completes (~30 seconds), the PR will be available at:

  • https://ap0ught.github.io/matrix/pr-66/
  • https://ap0ught.github.io/matrix/pr-66/?suppressWarnings=true

A bot comment will be posted with convenient test links for different Matrix versions.

Note

GitHub Pages needs to be enabled with the gh-pages branch as the source. The workflow will create this branch automatically on first run.

Copilot AI changed the title Cherry-pick critical bug fixes from upstream PR #66 Cherry-pick critical bug fixes from upstream PR #66 and add PR preview deployment Oct 7, 2025
Copilot finished work on behalf of ap0ught October 7, 2025 16:11
@ap0ught
Copy link
Owner

ap0ught commented Oct 7, 2025

@copilot Please find a solution for failing job 52172443811. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Copy link
Author

Copilot AI commented Oct 7, 2025

@copilot Please find a solution for failing job 52172443811. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include c...

Fixed the workflow authentication issues in commit 795f94c.

Root Cause

The workflow was failing because:

  1. Missing GitHub token authentication - Git push operations need authenticated URLs
  2. No git remote configuration - When initializing a new gh-pages branch, the remote wasn't configured with authentication
  3. Missing token in checkout actions - The checkout actions didn't explicitly use the GitHub token

Solution

Updated .github/workflows/pr-preview.yml with:

  1. Added token to all checkout actions:
token: ${{ github.token }}
  1. Set up authenticated remote during gh-pages initialization:
git remote add origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
  1. Configure remote URL before push if needed:
if ! git remote get-url origin | grep -q "x-access-token"; then
  git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git"
fi

The workflow should now successfully:

  • Checkout both the PR branch and gh-pages branch
  • Initialize gh-pages if it doesn't exist
  • Push the preview deployment with proper authentication
  • Post a comment on the PR with test links

You can manually trigger the workflow again from the Actions tab to test the fix.

Copilot finished work on behalf of ap0ught October 7, 2025 17:58
@ap0ught
Copy link
Owner

ap0ught commented Oct 7, 2025

@copilot Please find a solution for failing job 52182530909. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Copy link
Author

Copilot AI commented Oct 7, 2025

@copilot Please find a solution for failing job 52182530909. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include c...

Fixed workflow robustness issues in commit 3f3d24e.

Root Causes

The workflow was likely failing due to:

  1. Incomplete gh-pages checkout detection - Checked for directory but not .git subdirectory
  2. Missing initialization commit - New gh-pages branch wasn't committed before use
  3. Improper git configuration handling - When gh-pages exists, git config wasn't set
  4. Branch reference issues - Using head.ref instead of head.sha for checkout
  5. No change detection - Attempted to push even when nothing changed

Solution

Updated .github/workflows/pr-preview.yml with:

1. Better gh-pages detection:

if [ ! -d "gh-pages/.git" ]; then
  # Initialize new branch with proper setup

2. Complete initialization:

git add .
git commit -m "Initialize gh-pages branch"

3. Configuration for existing branches:

else
  echo "gh-pages branch exists, configuring..."
  cd gh-pages
  git config user.name "github-actions[bot]"
  git config user.email "github-actions[bot]@users.noreply.github.com"

4. Reliable checkout:

ref: ${{ github.event.pull_request.head.sha || github.sha }}

5. Conditional deployment:

if git diff --staged --quiet; then
  echo "No changes to deploy"
else
  git commit -m "Deploy preview: ${{ steps.preview.outputs.path }}"
  git push origin gh-pages --force

6. Improved remote configuration:

git remote set-url origin "..." || git remote add origin "..."

The workflow should now handle both first-time setup and subsequent deployments reliably. You can re-run the workflow to test.

Copilot finished work on behalf of ap0ught October 7, 2025 19:25
@ap0ught ap0ught merged commit 584c125 into master Oct 7, 2025
5 of 7 checks passed
@ap0ught ap0ught deleted the copilot/merge-upstream-pr-66 branch October 7, 2025 22:42
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.

merge upstream pr into this repo

2 participants