Skip to content

Drift check misses DLLs invalidated by compiler or runtime changes #43

Description

@skydread1

Problem

  • Committed .clj.dll (nostrand/references/, magic-unity/Runtime/Infrastructure/Export/) are guarded by source-SHA manifests that fingerprint each DLL's own .clj source, not the DLL bytes.
  • But a DLL's bytes depend on its source and the compiler and the runtime, so a change with no matching .clj edit silently leaves committed DLLs stale while drift stays green:
    • a compiler .clj change (e.g. hashing or emission behavior) re-emits other namespaces' DLLs, whose own source SHA never moved;
    • a runtime .cs change (e.g. hasheq) alters emitted bytes with no .clj change at all.
  • We cannot just byte-diff the DLLs to catch this, because compilation is non-deterministic: emission order comes from identity-hashed collections (Var, MethodInfo, Type), and every AssemblyBuilder.Save stamps a fresh MVID and PE timestamp.
  • Concrete incident: a hasheq change in the runtime altered the hashes baked into clojure.spec.alpha's regex-op case jump tables; the .clj never moved, drift stayed green, and the regex ops threw "No matching clause" at runtime.

Suggestion

  • Make compilation byte-deterministic:
    • sort member and interface emission by a stable key (lifted Vars, override methods, fn interfaces);
    • normalize assembly headers (MVID from a content hash, PE timestamp zeroed).
  • Then have drift check rebuild and byte-diff the committed DLLs, replacing the source-SHA manifests, so it catches staleness from any compiler or runtime change and not just a DLL's own source.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions