Skip to content

Keyword families: five definition questions for the owner (json, generators, closures, cleanup, telemetry) #8862

Done

Description

@squid-protocol

Questions that need an owner decision before anyone changes a list

Found by the keyword-family pilot (details in the epic). Each is a definition call, not a measurement bug; the pilot shows what the current rule does.

  1. JSON (de)serialization has no family. serialization_parsing is pickle|marshal|ast.literal_eval only (unsafe deserialization), so json.loads / json.dumps (978 + 416 functions in GitGalaxy's own code) count nowhere. Is a benign "serialization" family wanted, or is the current family intentionally the risky subset? If both, name them apart.
  2. Generator expressions are not "lazy evaluation". lazy_evaluation counts yield, Generator, Iterator (646 functions); 15,208 functions use a generator expression or comprehension. Should (x for x in xs) count?
  3. Closures. struct_closures has recall 0.45 / precision 0.98: it probably misses lambdas. Count lambdas or leave them out on purpose?
  4. Cleanup. def_cleanup recall 0.14 / precision 0.57 against with/finally: which forms are meant?
  5. Telemetry precision. def_telemetry fires in 4,899 functions where ast finds logger calls in 1,389: which extra forms are meant (print? metrics?).
    Answer each in a comment; the answers become the family definitions the validity test scores against.

Activity

  1. added
    question
    core-engine
    priority: low
    on Nov 21, 2026
  2. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Part of #8863 (keyword-family validity epic).

  3. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    The cross-language run (#8864) adds the other languages to the definition questions: #8868 lists the per-language differences that depend on what each family is meant to count (print to a writer, assert as a bail-out, time.Duration as time logic, is_documented doc styles). Please answer those here so the tool's one-sentence definitions can be set.

  4. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    The contracts already answer most of these. gitgalaxy/standards/signal_contracts.py carries a written contract for 71 families (43 declared, 16 stated, 12 draft). Reading them against the five questions above:

    1. JSON. Answered, and the engine contradicts it: serialization_parsing is "a call that encodes to or decodes from a structured interchange format -- JSON, XML, YAML, CSV, protocol buffers, a marshal or unmarshal". So JSON counts, and the Python rule's pickle-only matching is a bug: filed as serialization_parsing: the contract says JSON/YAML/XML/CSV/protobuf, the Python rule matches only pickle/marshal/literal_eval (0 of 72,044 functions fire, 699 call a codec) #8882.
    2. Generator expressions. Answered: lazy_evaluation is "a yield statement, a generator or iterator type annotation, an async-generator form". Generator expressions are not listed, so leaving them out is right, and the first oracle was right to leave them out.
    3. Closures. Answered: "the syntax that opens an anonymous callable -- a lambda, arrow function, block literal or inline callback". A nested named function is a declaration, not a closure. (My first Python oracle counted nested def; that was the oracle's error, now fixed. The measured gaps for Go, TypeScript and Rust closures remain.)
    4. Cleanup. Answered in the contract's wording: "a site that explicitly destroys state or releases a held resource -- a deallocation or finalization call, a handle or connection close, removal of an entry ... or the opener of a guaranteed-teardown region". Python scores 0.14 recall against that (with blocks, try/finally, del, rmtree missed); a gap, not a question.
    5. Telemetry. NOT answered: "structured logging and observability frameworks" is a draft contract with no construct named. Python precision is 0.28 (fires in 4,899 functions, a parser sees a logger call in 1,389).

    What is genuinely open: the 12 draft contracts (debug_prints, telemetry, concurrency, sync_locks, doc, and others), plus the readings in #8868 (is assert an abort? does a Go write to a writer count as a debug print? what counts as doc in a language without /** */?). This issue can be re-scoped to: ratify the oracle's reading of each contract, and fill in the draft ones. docs/*_rule_contract.md holds the long form for 18 of them.

    Also corrected from my earlier posts: oracles were aligned to the contracts on 2026-11-21 (bitwise_ops includes & and |; time_date_logic includes durations; doc is structured documentation). #8861, #8866 and #8868 carry the corrected numbers.

  5. squid-protocol commented on Nov 25, 2026

    @squid-protocol
    OwnerAuthor

    Ratified (owner, 2026-11-24). The written contracts in gitgalaxy/standards/signal_contracts.py are the definitions; the validity test scores against them.

    1. JSON counts as serialization_parsing (rule bug, serialization_parsing: the contract says JSON/YAML/XML/CSV/protobuf, the Python rule matches only pickle/marshal/literal_eval (0 of 72,044 functions fire, 699 call a codec) #8882).
    2. Generator expressions do not count as lazy_evaluation.
    3. Closures are anonymous callables only: lambdas count, nested named def does not. Go and Rust gaps are measurement bugs.
    4. Cleanup: with, try/finally, del, close and rmtree are meant. Python recall 0.14 is a rule bug.
    5. Telemetry is a log, metric or trace through a framework; a bare print is not telemetry. Python precision 0.28 is a rule bug.

    Three decisions from the open list:

    Everything else in #8868 is contract-answerable and becomes a fix, each timed per the epic rules. Closing; fixes are tracked under #8863.

  6. 5 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-enginepriority: lowquestion

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions