Skip to content

Helper child policy records should carry the probe snapshot path and worker PID #613

Open

Description

@ViperJuice

Policy skips raised from test helper child processes cannot be matched exactly to their Code Integrity 3077 records.

tests/native_policy.py's skip_policy_subprocess recognises only the trusted driver's typed record, and that record carries no artifact or process identity:

  • {"schema": "native_test.policy.v1", "winerror": <4551|1260>}, from run_isolated_baml_parse and the policy_aware_native_driver drivers;
  • {"schema": "native_test.policy_result.v1", "reason": "policy_blocked"}.

The child's own chunker.grammar.integrity DEBUG diagnostics, which do carry worker_pid/launcher_pid, go to the child's output, not to the parent pytest log. So a policy skip raised this way can be matched to a 3077 event only by time window, count and file kind, never by exact path or process ID.

This came up in the ADMIT EC-ADMIT-9 Windows campaign (treesitter-chunker#362, on treesitter-chunker#559 at 1c97bf47):

  • 4 helper-process skips (3 in series 1, 1 in series 5) each had a matching 3077 record by time, count and file type (.staged publication probe snapshots; a probe snapshot .dll).
  • None could be joined by path or PID.
  • The maintainer accepted them for this gate as time/count/file-type matches.
  • In-process policy skips and failures were joined exactly: the probe diagnostic's worker_pid equals the 3077 event's process ID, 28–40 ms apart.

Requested change (test harness only). Have the helper children include, in their typed policy record, the identity of what was blocked:

  • the probe's snapshot path, or the loaded library path for direct load_compiled_grammar children;
  • the process ID that attempted the load: the probe worker_pid, or the child's own PID for a direct load.

skip_policy_subprocess should then put them in the skip reason, so a campaign can join every policy skip to its 3077 record by path and process ID. Keep the record's strict shape check: extend the accepted key set explicitly, rather than accepting arbitrary keys.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions