IDL system should enforce uniqueness of feature flag names across files

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Problem

      The IDL parser checks for duplicate feature flag names only within a single file. Cross-file duplicates are silently accepted at parse time and surface only as a runtime uassert (code 23784) at server startup. The Python tooling that processes IDL file silently overwrites earlier definitions on a duplicate name.

      A developer can declare the same feature flag name in two different IDL files and receive no compile-time or generation-time error. The failure mode is either a server crash at startup or, in the Python tooling path, silent data loss (the second definition replaces the first).

      Steps to Reproduce

      1. Declare a feature flag with a given name in query_feature_flags.idl (or any IDL file).
      2. Declare a second feature flag with the same name in a different IDL file (like sharding_feature_flags.idl).
      3. Build and run mongoduassert 23784 fires at startup.
      4. Run the Python IDL tooling — the second definition silently overwrites the first with no error or warning.

      Expected Behavior

      The IDL code-generation pass should detect duplicate feature flag names across all input files and emit a fatal error — with both conflicting file names and line numbers — before producing any generated output.

      Suggested Fix

      In the IDL code-generation pass that aggregates feature flags across files, add a cross-file uniqueness check. On collision, report the conflicting definitions (file, line, name) and abort generation.

      Impact

      Developer-experience / correctness. A duplicate flag name is always a bug. Catching it at generation time (before the binary is built) is strictly better than a runtime crash or silent overwrite. This added complexity to SERVER-125794.

            Assignee:
            Unassigned
            Reporter:
            Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: