-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Server Programmability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Motivation
The IDL compiler is a fixed three-stage pipeline (parse, bind, generate) with every grammar hard-coded into its core. Adding a new top-level grammar today means editing the block dispatch in parser.py, the spec and symbol table, the binder, and the generator, and each grammar's logic ends up spread across files it does not own.
The unified metrics framework work (SPM-4962) requires adding a grammar for metrics. billy.donahue@mongodb.com asked whether it could be implemented as an extension to IDL that could be owned by DINO, rather than SP.
Proposal
Introduce a package registry into the IDL compiler. A package is a self-contained module that declares:
- the top-level IDL blocks it owns, with parse hooks
- a bind hook that validates and lowers its parsed entries
- code generation hooks (include contributions, header and source emission)
- requires edges on other packages; bind order and codegen emission order are derived from these edges at import
Feature flags and server parameters become the first two packages, as a behavior-preserving refactor: generated code for all existing IDL files is byte-identical, all error messages are unchanged, and the generated-code comparison against master is clean. The metrics grammar converts when its branch rebases; the dispatch_fallback and validate_file hooks are reserved for it (deferred-block reporting and file-naming policy).
- is related to
-
SERVER-138593 Metrics grammar and parser in the IDL compiler (*_metrics.idl)
-
- In Code Review
-