Finding
The static public-API inventory repair on #1717 correctly stopped executing discovered module names, but its AST dataclass projection no longer matches the runtime constructor contract that the inventory is supposed to describe.
Current #1717 head before this repair: 4493f58ac02ba16e08e2d8dc6b0e2ef2b2407db8.
tools/inventory_public_api.py::_ast_class_params() currently treats every public annotated dataclass field as a constructor parameter and drops every underscore-prefixed field. That is not how dataclass-generated __init__ works:
field(init=False) is not a constructor parameter even when the field name is public;
InitVar participates in the generated constructor, including an underscore-prefixed InitVar;
ClassVar does not participate in the generated constructor.
A concrete repository-owned regression is fast_mlsirm.scoring.rag.RAGPerturbationAnchor. Its canonical runtime-derived inventory row in docs/api/inventory-20260917.csv is:
anchor_id, baseline_request_fingerprint, perturbed_request_fingerprint, perturbation_specification_fingerprint, perturbation_run_fingerprint, perturbation_kind, _anchor_token=None
The source class also has public derived fields expected_construct, expected_direction, and construct_basis declared with field(init=False). The current static projection would include those three false constructor parameters and omit _anchor_token, changing the governed API inventory solely because the scanner implementation changed.
Required repair
Keep repository module discovery static. Do not restore importlib.import_module(modname), suppress Semgrep, or weaken SAST policy.
Acceptance:
- add a public regression against the real
RAGPerturbationAnchor source;
- static dataclass projection excludes
field(init=False) and ClassVar fields;
- it includes actual constructor
InitVar fields even when their names begin with _;
- existing default/default_factory rendering remains intact;
- exact-head inventory/CI/SAST evidence is reacquired after the causal fix.
This is API-governance tooling, not psychometric arithmetic; no scientific estimator behavior should change.
Finding
The static public-API inventory repair on #1717 correctly stopped executing discovered module names, but its AST dataclass projection no longer matches the runtime constructor contract that the inventory is supposed to describe.
Current #1717 head before this repair:
4493f58ac02ba16e08e2d8dc6b0e2ef2b2407db8.tools/inventory_public_api.py::_ast_class_params()currently treats every public annotated dataclass field as a constructor parameter and drops every underscore-prefixed field. That is not how dataclass-generated__init__works:field(init=False)is not a constructor parameter even when the field name is public;InitVarparticipates in the generated constructor, including an underscore-prefixedInitVar;ClassVardoes not participate in the generated constructor.A concrete repository-owned regression is
fast_mlsirm.scoring.rag.RAGPerturbationAnchor. Its canonical runtime-derived inventory row indocs/api/inventory-20260917.csvis:anchor_id, baseline_request_fingerprint, perturbed_request_fingerprint, perturbation_specification_fingerprint, perturbation_run_fingerprint, perturbation_kind, _anchor_token=NoneThe source class also has public derived fields
expected_construct,expected_direction, andconstruct_basisdeclared withfield(init=False). The current static projection would include those three false constructor parameters and omit_anchor_token, changing the governed API inventory solely because the scanner implementation changed.Required repair
Keep repository module discovery static. Do not restore
importlib.import_module(modname), suppress Semgrep, or weaken SAST policy.Acceptance:
RAGPerturbationAnchorsource;field(init=False)andClassVarfields;InitVarfields even when their names begin with_;This is API-governance tooling, not psychometric arithmetic; no scientific estimator behavior should change.