Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions doc/high_risk_pre_merge_readiness.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,48 @@ other changed production source, adds any affected chat impact and supplies the
corresponding coverage. An internally consistent result still exits 2 for the
unconfigured external prerequisites; it never establishes operational readiness.

A second Git-derived refinement covers export-only changes to `lib/backend.dart`
and `lib/llamadart.dart` (`exportOnlyEntrypoints`), such as #1791's
`BackendTextToSpeechModelSupport` SPI export. Such an entrypoint contributes no
minimum impacts, so each impact may be `applicable: false` with a rationale and
production references. Everything else above still applies, including causal
test evidence for the export and the declaring sources' own contributions.

The entrypoint must be modified in place as a non-executable regular blob at
both revisions, and both revisions must parse. Removing every export
directive's whole lines must leave them byte-identical, so any other changed
line keeps the full requirement: a comment, import, declaration or library doc.
A directive must not share a line with other code or carry annotations. Every
base export stays with the same URI, conditional branches and combinators,
except that a single `show` list may gain names. A new directive must be
unconditional with a single `show`. Removed names, wildcards, `hide` changes and
conditional additions keep the requirement.

Each added name must resolve through head blobs to its declaration, in every
branch of a conditional export. Every library on that chain must already exist
at base and lie outside structured-output areas. `isStructuredOutputExport`
rejects the classifier's structured paths, including the public entrypoints,
and any path or name containing `chat`, `template`, `jinja`, `render`,
`grammar`, `gbnf`, `schema`, `pars`, `tool`, `structured`, `completion` or
`stream`. No other export route, and no declaration in the entrypoint itself,
may reach an added name. Parts, nonlocal exports, cycles and unknown
declaration shapes on any route the check inspects keep the requirement.

The declaration itself must be the only top-level declaration of that name and
a class, enum or mixin; typedefs, class aliases, functions, getters, variables
and extensions can rebind or extend existing names and keep the requirement, as
does any name that `dart:core`, `dart:async` or `dart:convert` (read from the
running SDK) declares. The declaring library may add no import of a structured
path or another package. Every identifier token in the declaration, from its
annotations to its member bodies, is looked up among the library's own
declarations and every import that admits it, and each declaration found is
checked the same way, transitively. Reaching a structured-output library, or an
import the evaluator cannot follow (another package or an uncertain export
graph), keeps the requirement. Matching tokens by name over-approximates
references, so a member or parameter name equal to a structured export also
keeps it; an existing structured import that provides none of the tokens, such
as `tool_definition.dart` beside #1791's export, does not.

The `families` list retains unique `tested`/`unavailable` entries, relevant tests
and a rationale. Missing weights require named unavailable families and primary
upstream emissions plus fixtures; unrelated model evidence remains pipeline-only.
Expand Down
36 changes: 36 additions & 0 deletions test/unit/tooling/classify_high_risk_changes_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,42 @@ void main() {
);
});

test('exports from structured-output areas keep the full requirement', () {
expect(
isStructuredOutputExport(
'lib/src/backends/backend.dart',
'BackendTextToSpeechModelSupport',
),
isFalse,
);
for (final (path, symbol) in [
('lib/src/core/template/chat_format.dart', 'Format'),
('lib/src/core/grammar/limits.dart', 'Limits'),
('lib/src/core/models/tools/tool_param.dart', 'Param'),
('lib/src/core/models/chat/chat_role.dart', 'Role'),
('lib/src/core/engine/chat_template_renderer.dart', 'Renderer'),
('lib/src/backends/litert_lm/litert_lm_templates.dart', 'Templates'),
('lib/src/backends/backend.dart', 'BackendNativeChatGeneration'),
('lib/src/backends/backend.dart', 'BackendGrammarConstraintsSupport'),
('lib/src/backends/backend.dart', 'BackendJsonSchemaChatGeneration'),
('lib/src/backends/backend.dart', 'BackendToolResultMedia'),
('lib/src/core/engine/engine.dart', 'LlamaEngineCompletionExtension'),
('lib/src/core/engine/engine.dart', 'ParseResult'),
('lib/src/core/engine/engine.dart', 'TokenStream'),
('lib/src/backends/backend.dart', 'JinjaEnvironment'),
('lib/src/backends/backend.dart', 'RenderOptions'),
('lib/src/backends/backend.dart', 'GbnfRule'),
('lib/src/backends/backend.dart', 'SchemaNode'),
('lib/src/backends/backend.dart', 'StructuredReply'),
]) {
expect(
isStructuredOutputExport(path, symbol),
isTrue,
reason: '$path $symbol',
);
}
});

group('assessHighRiskFiles', () {
test('only exact root ffigen config is an artifact consumer', () {
expect(assessHighRiskFiles(['ffigen.yaml']).surfaces, {
Expand Down
Loading
Loading