Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
davesnx
force-pushed
the
generate-dependency-order
branch
from
September 23, 2026 06:11
a3d5397 to
295f1b0
Compare
Order.sort bounded its emission loop by List.length nodes, but node_of_key collapses nodes that share a key (Hashtbl.replace, later wins), so with the same input file passed twice the loop could never emit enough nodes and styled-ppx.generate hung. Bound the loop by the number of distinct keys instead. Cram test duplicate-input.t passes one file twice and expects the single-input output.
davesnx
force-pushed
the
generate-dependency-order
branch
from
September 23, 2026 06:39
295f1b0 to
c147c6c
Compare
Owner
Author
|
Superseded by #616, which carries this branch's commits rebased onto main together with the rest of the CSS ordering work. |
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.
styled-ppx.generatenow emits a module's rules after the rules of every module it depends on, instead of in the order dune lists the files. Every atomic rule has the same specificity, so a consumer's equal-specificity declaration now beats its dependency's by construction, and renaming a file no longer moves rules. Modules with no dependency between them keep alphabetical path order, so output changes only where a dependency forces it. Dedup by first occurrence runs after the sort.Mechanism: a new
packages/generate/order.mlcomputes each file's referenced module names with compiler-libsDependon the AST the generator already reads (the same walkocamldep -modulesuses), resolves them to input files by longest shared directory prefix, and runs a Kahn sort that always picks the smallest path among ready nodes. A cycle can only come from an ambiguous module name; the generator warns once, drops the edge whose source sorts last, and continues.--order sourcekeeps the previous behaviour for one release;--log infoprints the module order and--log debugthe edges.Evidence at a594d02:
order-dependency,order-unrelated,order-ambiguous-name,order-source-flag,order-cycleinpackages/generate/test;log-flags.tgains the neworder:info line.make format-check,make build,make test: all exit 0.Review from
packages/generate/order.ml, thenorder_by_dependencyingenerate.ml. The resolution rule for same-named modules is deliberately conservative (no edge on a tie) and is replaced by library membership in the follow-up library-order PR.Risk: two-way door. A revert restores input-order emission. Until then, consumers aggregating several modules see rules move relative to today; a winner-diff script in the next PR of this stack lists exactly which cascade ties flip.