Repository navigation
fix(control): stop rebuilding hearth-control on every cargo run - #47
Open
PermutationResearch wants to merge 1 commit into
Open
PermutationResearch wants to merge 1 commit into
PermutationResearch wants to merge 1 commit into
Conversation
build.rs watched web/console/dist unconditionally. Cargo treats a watched path that does not exist as changed (fingerprint::find_stale_file returns StaleItem::MissingFile when mtime_recursive fails), so wherever the console had not been built, CI included, the build script reran and the crate recompiled on every cargo invocation. In CI that cost about 30 s per extra cargo command: the unit-test step recompiled what the build step had just built. Watch dist once it exists, and until then the console directory, whose own mtime changes when a build creates dist. If neither exists, watch neither. The embedded HEARTH_CONSOLE_DIST is unchanged in every layout.
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.
crates/hearth-control/build.rsalways told Cargo to watchweb/console/dist. Cargo treats a watched path that does not exist as changed: infingerprint::find_stale_file, a failedpaths::mtime_recursivereturnsStaleItem::MissingFile. So wherever the console had not been built, CI included, the build script reran andhearth-controlrecompiled on every cargo invocation.Evidence
In #42's runs, the unit-test step recompiled
hearth-controlimmediately after the build step had compiled it, with no source change in between:hearth-controlhearth-controlChange
Watch
distonce it exists, and until then theweb/consoledirectory. Creatingdistchanges that directory's own mtime, which Cargo's recursive scan includes, so building the console later still triggers a rebuild. If neither exists, watch neither.Running the old and new scripts on their own against three layouts:
HEARTH_CONSOLE_DISTdist, missingweb/consoleconsole-missing, unchangeddistdistdistpath, unchangedweb/consoledist, missingconsole-missing, unchangedconsole-missingis watched in all cases, as before.Trade-off
While
distis absent, any change underweb/console(sources,node_modules) reruns the script and recompiles the crate. Cargo also walks that directory on each build. That is narrower than today's rebuild on every invocation, but it is not free on a checkout withnode_modulesinstalled and nodist.Not yet verified
hearth-controlcompiled once, in the build step, and not again in the unit-test step.Stacked on #43 (
fix/hearth-template-db).🤖 Generated with Claude Code