You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(secrets): consolidate vso sanitization onto canonical helper (#624)
Round-5 PR review cleanup. No bugs flagged — three maintainability
suggestions, all addressed:
- **F1: reuse `crate::sanitize::neutralize_pipeline_commands`.** The
codebase already has a canonical pipeline-command neutraliser at
`src/sanitize.rs:145` (used by the `SanitizeContent` /
`SanitizeConfig` pipelines for safe outputs and front-matter
sanitisation). The round-4 fix introduced two private
`sanitize_for_vso_logging` helpers — one in
`src/compile/extensions/ado_aw_marker.rs`, one in
`src/ado/discovery.rs` — that hard-coded the
`[vso-filtered][` / `[filtered][` form copied from
`agent_stats::sanitize_for_markdown`. Both private copies removed in
favour of the canonical helper. The canonical helper uses
backtick-wrapping (`` `##vso[` `` / `` `##[` ``) which equally
defeats the ADO agent's stdout scanner; the threat model is
unchanged. Tests in both files updated to assert the canonical
output. The two now-redundant unit tests for the local helpers are
removed; their behavioural coverage already lives in
`src/sanitize.rs:570-605`.
- **F2: two-pass classify-then-filter in
`resolve_definitions_via_discovery`.** The previous shape mutated
four counter variables as a side-effect inside a `.filter()` closure
that *also* decided inclusion — the local `kept` variable then held
items that would be dropped later by `discovered_to_matched`,
misleading any reader. Rewritten as an explicit `for` loop that
classifies + counts in pass 1, emits warnings + converts to
`MatchedDefinition` in pass 2. Renamed `kept` to `selected` to
match what the variable actually holds.
- **F3: comment on the non-`.md` fallthrough in `is_direct_match`.**
Explains that the unreachable-today branch is a forward-compat
measure for hypothetical `.yaml` / `.json` agent sources and that
the conservative behaviour (treat as `Consumer`, not `Direct`)
keeps write commands acting on the definition while labelling it
honestly in the summary.
Net test delta: −2 (the two duplicate sanitizer unit tests). 1751
tests pass; clippy clean on touched files.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments