Skip to content

[MISRA-CERT-18] No deterministic build / reproducible output guarantee #280

Closed

Description

@godofecht

Description

Safety certification requires reproducible builds: the same Flow source must produce byte-identical C output every time. The C generator does not guarantee this.

Potential sources of nondeterminism:

  • Dict/set iteration order in Python (module resolution, struct field ordering, span typedef emission).
  • File system traversal order for module discovery.
  • Timestamps in generated comments (if any).

Standards

  • DO-178C requires reproducible builds for tool qualification.
  • ISO 26262 requires deterministic tool output.

Fix

  1. Audit src/flow/c_generator.py and src/flow/module_resolver.py for nondeterministic iteration (use sorted() on dict/set keys before emitting).
  2. Add a CI test: compile the same Flow file twice, diff the C output, fail if different.
  3. Document the reproducible build guarantee in docs/certification/reproducible-builds.md.
  4. Add flow compile --deterministic flag that enforces sorted iteration everywhere.

Audit ID: MISRA-CERT-18

Severity: Medium | Category: Build system - reproducibility

Activity

  1. added
    enhancement
    MISRA
    CERT
    certification
    on Aug 9, 2026
  2. added 2 commits that reference this issue on Aug 10, 2026
  3. godofecht commented on Aug 10, 2026

    @godofecht
    ContributorAuthor

    Implemented: C output is deterministic for the same input. Documented in docs/certification/reproducible-builds.md. Test in tests/unit/test_reproducible_c.py verifies byte-identical output across runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CERTMISRAcertificationcompilerenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions