Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Addresses review feedback on PR #732 regarding potential division by zero when uploading empty Docker images.

Changes

  • Added guard condition in progressCallback to return early when total == 0
  • Prevents panic from percentage calculation float64(current) / float64(total) * 100 and progress bar width computation
progressCallback := func(current, total int64) {
    // Guard against division by zero
    if total == 0 {
        return
    }
    
    percentage := float64(current) / float64(total) * 100
    // ... rest of progress display logic
}

The callback silently skips progress updates for zero-byte files rather than crashing.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ss callback

Co-authored-by: cdalar <62673+cdalar@users.noreply.github.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor Author

Copilot AI commented Nov 8, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • httpstat.us
    • Triggering command: /tmp/go-build2216071293/b641/cmd.test -test.testlogfile=/tmp/go-build2216071293/b641/testlog.txt -test.paniconexit0 -test.timeout=10m0s (dns block)
    • Triggering command: /tmp/go-build1132390078/b001/cmd.test -test.testlogfile=/tmp/go-build1132390078/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)
  • invalid-url-that-does-not-exist
    • Triggering command: /tmp/go-build2216071293/b641/cmd.test -test.testlogfile=/tmp/go-build2216071293/b641/testlog.txt -test.paniconexit0 -test.timeout=10m0s (dns block)
    • Triggering command: /tmp/go-build1132390078/b001/cmd.test -test.testlogfile=/tmp/go-build1132390078/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update environment and deployment changes based on PR feedback Fix division by zero in Docker image upload progress callback Nov 8, 2025
Copilot AI requested a review from cdalar November 8, 2025 09:15
@cdalar cdalar marked this pull request as ready for review November 8, 2025 12:29
@cdalar cdalar merged commit 04fdf8a into env-and-deploy Nov 10, 2025
7 of 8 checks passed
cdalar added a commit that referenced this pull request Nov 10, 2025
* feat: add guidelines for onctl CLI development and enhance command structure

- Introduced development guidelines in `onctl-development.md` for Go best practices, error handling, testing, and CLI design patterns.
- Updated `AGENTS.md` to include the new guidelines.
- Enhanced `create`, `destroy`, `list`, `ssh`, and `vm` commands by registering them at the root level for easier access.
- Implemented `deploy` command for deploying Docker images to remote VMs with progress tracking and architecture compatibility checks.
- Improved error handling and logging in various commands and internal functions.
- Added support for environment management with `env` command, allowing creation and destruction of environments from template files.

* feat: enhance Docker image deployment process with Docker Hub checks and architecture validation

* feat: add linting target to Makefile and improve error handling in commands

* Update cmd/list.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: correct typo in output flag usage and improve error handling in remote session closure

* test: add comprehensive tests for deploy, env, AWS provider, and SCP functionalities

* test: improve image sorting tests and handle nil creation dates gracefully

* feat: add initial golangci-lint configuration for staticcheck

* fix: correct version formatting in golangci-lint configuration

* fix: improve error handling in SSH connection passphrase and private key parsing

* Update internal/provideraws/common.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix publicIP

* feat: add NSG client and implement NSG creation in Azure provider

* Initial plan (#736)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Fix division by zero in Docker image upload progress callback (#735)

* Initial plan

* fix: add guard condition to prevent division by zero in upload progress callback

Co-authored-by: cdalar <62673+cdalar@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cdalar <62673+cdalar@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cdalar <62673+cdalar@users.noreply.github.com>
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