← Back to Pull requests

Ignore C0 and DEL while parsing DCS parameters #20919

Merged
DawsonCodes merged 2 files (17 lines) on Nov 20, 2026 01:24 UTC
View on GitHub
DawsonCodes DawsonCodes commented on Nov 15, 2026 04:50 UTC
Author

Summary of the Pull Request

Ignore C0 and DEL characters while parsing the parameters of a Device Control String (DCS).

References and Relevant Issues

Closes #20916
The dcs param state ignores BEL (0x07) and DEL (0x7F) and continues collecting parameters. DEC ANSI parser state diagram

Detailed Description of the Pull Request / Additional comments

_EventDcsParam() calls _ActionIgnore() for C0 and DEL, then falls through to a separate conditional chain that can dispatch the same byte as the final character. Changing the numeric/delimiter branch to else if keeps the parser in DcsParam so the next byte can continue the same sequence.

The regression test places BEL between two digits and DEL before the final character. It checks the dispatched identifier, both parameters, and the payload.

AI assistance was used to prepare the change, validate it locally, and draft this description.

Validation Steps Performed

  • GitHub Actions built and ran the native Windows x64 Release parser suite. TAEF reported 760 passed, 0 failed, and 1 skipped. Upstream explicitly skips InputEngineTest::RoundTripTest. Windows Actions run

  • The new regression failed at the DCS identifier assertion with the original parser and passed with the fix.

  • As a supplementary check, a standalone AI-generated harness compiled Terminal’s stateMachine.cpp on Linux with compatibility shims. It passed 4,422 checks covering ignored control bytes in DCS parameters and sequences split across writes. Harness details

  • PR Checklist

  • Closes #20916

  • Tests added/passed

  • Documentation updated

  • Schema updated (if necessary)
  • Diff: 17 lines (+16 / -1) across 2 files Reviewer: lhecker Review duration: 6993m
    All Vouch review confidence checks passed
    Residual risk 0.07 = Change Risk (0.22) × (1 − Review Confidence (0.68)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.22 · 17 lines diff across 2 files
    0.22
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.46 · 5 substantive comment(s)
    0.46
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    68%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.173
    Real PR Conversation Timeline
    10 items
    azure-pipelines[bot] azure-pipelines[bot] commented on Nov 15, 2026 04:50 UTC
    Bot

    <!-- AzurePipelinesStatusComment -->
    <samp>
    Azure Pipelines:<br>
    There may be pipelines that require an authorized user to comment /azp run to run.<br>

    </samp>

    DawsonCodes DawsonCodes commented on Nov 15, 2026 04:53 UTC
    Author

    @microsoft-github-policy-service agree

    DHowett DHowett commented on Nov 16, 2026 16:25 UTC
    Contributor

    The Linux C++ parser harness passed 4,422 stream checks under AddressSanitizer and UndefinedBehaviorSanitizer. These covered every ignorable C0 byte and DEL, character-by-character input, and every two-write split for the test sequences.

    Excuse me, what? Can you explain what part of our project this is, or what bearing it has on our project?

    lhecker lhecker approved these changes on Nov 16, 2026 16:26 UTC
    Approved Reviewer

    Neat!

    DHowett DHowett requested changes on Nov 16, 2026 16:28 UTC
    Changes Requested Reviewer

    I'd like to discuss this "Linux" thing a little more.

    DawsonCodes DawsonCodes commented on Nov 16, 2026 16:35 UTC
    Author

    The 4,422 checks came from a standalone harness the AI assistant created and ran while preparing this fix. It compiled Terminal’s stateMachine.cpp with Linux compatibility shims and exercised DCS sequences with different control bytes and write boundaries. That count was for the scratch harness, which I should have made clear in the PR description.

    The Windows Actions run on my fork used Terminal’s own parser test suite. DcsParamIgnoresControlCharacters failed at the DCS identifier assertion with the original parser and passed with the patch. TAEF reported 760 passed, 0 failed, and 1 skipped. Windows test run

    DHowett DHowett commented on Nov 20, 2026 00:48 UTC
    Contributor

    /azp run

    azure-pipelines[bot] azure-pipelines[bot] commented on Nov 20, 2026 00:48 UTC
    Bot

    <samp>
    Azure Pipelines:<br>
    Successfully started running 1 pipeline(s).<br>
    1 pipeline(s) were filtered out due to trigger conditions.<br>

    </samp>

    DHowett DHowett approved these changes on Nov 20, 2026 00:48 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    DawsonCodes DawsonCodes
    Labels
    risk: low confidence: 68.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 21.8% (LOW) · Higher = larger blast radius
    21.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 68.2% · Lower = rushed or shallow review
    68.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 6.9% · Safe to merge
    6.9%