Refactor Board DRC to aggregated async checks and prevent duplicate runs#1990
Open
Refactor Board DRC to aggregated async checks and prevent duplicate runs#1990
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Comment on lines
+556
to
+558
| // Routing checks should only run once child subcircuits are fully routed. | ||
| // Netlist checks should always run, even when routing is disabled. | ||
| if (shouldRunRoutingChecks && !this._areChildSubcircuitsRouted()) return |
Contributor
There was a problem hiding this comment.
Critical logic bug: When shouldRunRoutingChecks is true but children aren't routed yet, this early return prevents ALL checks from running, including netlist checks. This violates the PR requirement that "netlist checks should always run, even when routing is disabled."
If routing is enabled but children aren't routed, netlist and placement checks are blocked unnecessarily. The early return should be moved inside the conditional check assembly logic to only skip adding routing checks, not prevent all checks:
// Remove the early return here
// if (shouldRunRoutingChecks && !this._areChildSubcircuitsRouted()) return
if (this._drcChecksComplete || this._drcChecksInProgress) return
const runDrcChecks = async (circuitJson: AnyCircuitElement[]) => {
const checksToRun: Promise<AnyCircuitElement[]>[] = []
// Only add routing checks if children are routed
if (shouldRunRoutingChecks && this._areChildSubcircuitsRouted()) {
checksToRun.push(
runAllRoutingChecks(circuitJson) as Promise<AnyCircuitElement[]>,
)
}
// ... placement and netlist checks continue regardless
}
Suggested change
| // Routing checks should only run once child subcircuits are fully routed. | |
| // Netlist checks should always run, even when routing is disabled. | |
| if (shouldRunRoutingChecks && !this._areChildSubcircuitsRouted()) return | |
| // Routing checks should only run once child subcircuits are fully routed. | |
| // Netlist checks should always run, even when routing is disabled. |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
routingDisabled/pcbDisabledconfiguration.Description
runAllNetlistChecks,runAllPlacementChecks, andrunAllRoutingChecksfrom@tscircuit/checksand removed the old per-check invocation/insert logic._drcChecksInProgressflag and guards to avoid re-entrancy, and computeshouldRunNetlistChecks,shouldRunPlacementChecks, andshouldRunRoutingChecksto conditionally assemble which aggregated checks to run.Promise.all, and insert results withdb.insertAll(checkResults.flat())instead of inserting per-check results inline._queueAsyncEffect("board:drc-checks", ...)and set_drcChecksComplete/_drcChecksInProgressappropriately in atry/finallyblock.package.jsonfor@tscircuit/checksand@tscircuit/circuit-json-util, and updated a DRC test snapshot to match the new error id format.Testing
tests/drc/pcb-port-not-connected-error.test.tsxand updated its inline snapshot to reflect the new error id, with the test passing.Codex Task