Skip to content

fix: handle undefined effort in getEffortScale (#1525) - #1738

Open
thairc-dev wants to merge 2 commits into
tscircuit:mainfrom
thairc-dev:fix/handle-undefined-effort-in-geteffortscale
Open

fix: handle undefined effort in getEffortScale (#1525)#1738
thairc-dev wants to merge 2 commits into
tscircuit:mainfrom
thairc-dev:fix/handle-undefined-effort-in-geteffortscale

Conversation

@thairc-dev

Copy link
Copy Markdown

Summary

Closes #1525

When params.effort is undefined, Math.max(undefined, 1e-2) in getEffortScale evaluates to NaN. This causes MAX_ITERATIONS to evaluate to NaN across downstream solvers, triggering an immediate 'ran out of iterations' failure on small boards.

This PR updates getEffortScale to safely handle undefined or non-numeric effort inputs by defaulting to 1.

Testing

  • Added unit test tests/get-effort-scale.test.ts verifying undefined, NaN, normal, and minimum effort scale calculations.
  • All unit tests pass 100%.

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
capacity-node-autorouter Ready Ready Preview, Comment Jul 22, 2026 11:02am

Request Review

@tscircuitbot

Copy link
Copy Markdown
Contributor

Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [benchmark.sh args...]
/benchmark-long [benchmark.sh args...]
/benchmark-all

Comment /benchmark to run the default dataset, or append any arguments accepted by ./benchmark.sh.
Comment /benchmark-long for an 8-vCPU run that defaults to 8 workers and has an eight-hour timeout.
Comment exactly /benchmark-all to start separate workflow runs and result comments for the default dataset plus srj18, srj19, srj20, srj21, and srj23.

Everything after /benchmark or /benchmark-long is safely forwarded to ./benchmark.sh, except --profile-solvers, which enables profile comparison tables.
Examples: /benchmark --dataset 18 --sample-timeout 2000s, /benchmark --pipeline 7 --scenario-limit 20, /benchmark all 20 --concurrency 8, and /benchmark-long --dataset 18.

Use /update-snapshots (or /us) to run BUN_UPDATE_SNAPSHOTS=1 bun test --timeout 120_000 on the PR branch and auto-commit snapshot updates.
Use /usf to read recent failed test files, run BUN_UPDATE_SNAPSHOTS=1 bun test --timeout 120_000 <files>, auto-commit snapshot updates, then verify with bun test <files>.

Any PR whose title contains [BENCHMARK TEST] will automatically run one default-dataset benchmark on PR updates; it does not post a PR result comment.

@thairc-dev

Copy link
Copy Markdown
Author

Unit test tests/get-effort-scale.test.ts passes 100% (5/5). Fixed TypeScript types for HgPortPointPathingSolverClass and TinyHypergraphPortPointPathingSolver. All CI checks are green (11/11). Ready for review!

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

@thairc-dev

Copy link
Copy Markdown
Author

Friendly bump on this PR. All CI checks pass 100% and unit tests are included.

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getEffortScale returns NaN for undefined effort -> MAX_ITERATIONS NaN -> instant 'ran out of iterations'

2 participants