Skip to content

build(deps): apply round-4 §13.7 entry-length sort to dep blocks - #37

Merged
vshengbro merged 3 commits into
masterfrom
refactor/dep-order-round-4-2026-09-27
Sep 27, 2026
Merged

vshengbro merged 3 commits into
masterfrom
refactor/dep-order-round-4-2026-09-27

Conversation

@vshengbro

Copy link
Copy Markdown
Member

Summary

Apply rust-standards §13.7 round-4 ordering: dep entries are sorted by
total whitespace-agnostic character count (primary), then by dep
key
(secondary). The previous verifier only sorted lexicographically,
which let several blocks drift out of the canonical round-4 order.

This branch ships the updated verify_dep_order.py + fix_dep_order.py
and applies fix_dep_order.py --write to all in-repo Cargo.toml files.

Both scripts share verify_dep_order.entry_sort_key so the canonical
order is defined in one place (audit-pitfalls §48).

Infra changes (skill/scripts)

  • verify_dep_order.py: sort key now (entry_length, dep_key) instead
    of just dep_key. Tightened the trim guard so a missing boundary
    blank is no longer hidden by trailing-blank trimming (audit-pitfalls
    §70). Skip */tmp/test_*/Cargo.toml crate-cli fixtures from the
    violation count.
  • fix_dep_order.py: imports entry_sort_key from verifier; serializes
    blocks with the same followed_by_blank semantic.

Workspace changes

repo files changed
hyperlane (#37) 6 — root [workspace.dependencies] + 5 sub-crates' [dependencies]
euv 0 (already round-4 in alphabetical-subset cases; verifier/fixer script changes apply repo-wide when adopted)
ctares (#18) 4 — root + 3 sub-crates

Verification

  • verify_dep_order.py: 0 violations in tracked files (both repos)
  • cargo check --workspace --offline: 0 errors
  • cargo clippy --workspace --all-targets --offline: 0 warnings
  • cargo test --workspace --offline: all green
  • crate fmt twice: idempotent

Notes

  • The audit-pitfalls entries for §70, §71, §72 describe the three bugs
    found while wiring the round-4 sort: hidden middle-blank violation,
    double-blank serializer output, parse/sort/serialize contract.
  • No version bumps; this PR is purely a Cargo.toml layout fix.
  • tmp/test_*/Cargo.toml fixtures are skipped from verify_dep_order.py
    violation counts; they remain in the file scan output but report 0
    violations.

eastspire and others added 3 commits September 27, 2026 11:28
verify_dep_order.py was too tolerant: it trimmed trailing blanks from
both actual and expected sequences, so a missing blank at the
local/third-party boundary was silently accepted. Tighten the trim
guard (only trim actual_seq blanks past expected_seq length) so the
boundary blank is enforced.

fix_dep_order.py now parses blocks the same way the verifier does
(per-entry followed_by_blank flag), so verifier and fixer agree on
what 'correct' means (audit-pitfalls §48).
verify_dep_order.py now sorts entries by total whitespace-agnostic
character count (primary) and dep key (secondary), per round-4 §13.7
stated in the skill (SKILL.md scripts table §13.7 round 4). The
previous round-3 implementation only sorted lexicographically, which
let several blocks drift: hyperlane's [workspace.dependencies] and the
sub-crate [dependencies] blocks had not been round-4 sorted.

fix_dep_order.py reuses verify_dep_order.entry_sort_key so the two
scripts agree on the canonical order.

Tightens the verifier so missing boundary blanks are no longer hidden
by the trim guard (audit-pitfalls §70) and so the /tmp/test_*
crate-cli fixtures are skipped from the violation count.

6 Cargo.toml files affected in this workspace.
…r 13.8

rust-standards 13.8 (2026-09-27 user directive): "Cargo.toml different
configuration fields need a blank line between".  Every top-level
[section] header in any Cargo.toml MUST be preceded by exactly one
blank line if it follows non-section content.

5 Cargo.toml files affected in this workspace (root + 4 sub-crates):

  - Cargo.toml: [dependencies] was directly after the closing ] } of
    tokio-rustls = { ... ] } in [workspace.dependencies].
  - core/Cargo.toml: [dev-dependencies] directly after
    lombok-macros = { workspace = true }.
  - macros/Cargo.toml: [dev-dependencies] directly after
    proc-macro2 = { workspace = true }.
  - request/Cargo.toml: [dev-dependencies] directly after
    tokio-tungstenite = { workspace = true }.
  - type/Cargo.toml: [dev-dependencies] directly after
    serde_urlencoded = { workspace = true }.

Inserted one blank line before each affected section header. No entry
text / no block-internal ordering changes. 13.7 round-4 dep-block
order (already applied) is unaffected.

Verification:
  - verify_section_blanks.py: 8 files, 0 violations
  - verify_dep_order.py: 35 files, 0 violations
  - cargo check --workspace --offline: 0 errors
  - audit check 40 (13.8): PASS
@vshengbro
vshengbro merged commit b3cd57a into master Sep 27, 2026
8 checks passed
@vshengbro
vshengbro deleted the refactor/dep-order-round-4-2026-09-27 branch September 27, 2026 04:43
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.

1 participant