Skip to main content

evaluate_stream

Function evaluate_stream 

Source
pub fn evaluate_stream(
    surface: &AgentSurface,
    scope: &Scope<'_>,
) -> Result<Findings, AppError>
Expand description

GAP-SG-215: the same verdict, for a payload that is a STREAM of records.

evaluate answers about one complete envelope, and every question it asks past the refusals — which member is the result array, is that array declared, did a ceiling cut it — is a question about envelope structure a stream does not have. Running it per line is precisely the defect this closes: --select name export projected three records correctly and then failed on the fourth line, the summary, because that line is a different shape and was judged as though it were a record.

So a stream gets the two decisions that ARE about records, sharing the very functions evaluate uses:

  • the stream refusals, so an unusable knob fails before the first byte
  • projection resolution against the record vocabulary, so --select is answered ONCE for the whole stream instead of once per line

scope is built from a bounded prefix of the records rather than from all of them. super::vocabulary::Scope::classify scans every element it is given, and giving it every element of a 100 000-row export would mean holding the whole corpus as Value — measured at ~24 KB per record, so ~2.4 GB. The prefix is the honest bound, and vocabulary_partial on the trailer declares that it was one. It is still strictly stronger than what it replaces, which judged each line in isolation against no vocabulary at all.

§Errors

Returns AppError::Usage — exit 2 — before the caller has written anything, which is the property the per-line path could not offer.