Skip to content

fix: stale doc comment and unescaped service connection name#229

Closed
jamesadevine wants to merge 1 commit into
mainfrom
fix/docs-inaccuracies
Closed

fix: stale doc comment and unescaped service connection name#229
jamesadevine wants to merge 1 commit into
mainfrom
fix/docs-inaccuracies

Conversation

@jamesadevine

Copy link
Copy Markdown
Collaborator

Two small fixes:

  1. Stale doc comment (common.rs:84-85): Removed orphaned generate_schedule doc lines that were accidentally prepended to the generate_parameters() doc comment.

  2. Service connection YAML escaping (common.rs:901): The azureSubscription value in generate_acquire_ado_token() now escapes single quotes ('' in YAML) to prevent malformed pipeline output if a service connection name contains a quote character.

Ref: issue #228 created for the separate resolve-pr-thread naming inconsistency.

- Remove orphaned schedule doc comment accidentally prepended to
  generate_parameters() during earlier refactoring
- Escape single quotes in service connection names when emitting
  azureSubscription YAML values to prevent malformed pipeline output

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine

Copy link
Copy Markdown
Collaborator Author

Closing — changes were applied to the wrong branch. Moving to unify-compilers PR #226.

@jamesadevine jamesadevine deleted the fix/docs-inaccuracies branch April 16, 2026 14:24
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Rust PR Review

Summary: Looks good — both fixes are correct, but the escaping change is missing a regression test.

Findings

⚠️ Suggestions

  • src/compile/common.rs:899 — no test for the new escaping path

    The fix (sc.replace('\'', "''")) correctly implements YAML single-quoted scalar escaping (doubling the quote), but there's no test exercising a service connection name that actually contains a single quote. The existing test_generate_acquire_ado_token_with_sc still passes because "my-arm-sc" has no quotes to escape — so it doesn't exercise the new branch. A small test case like:

    #[test]
    fn test_generate_acquire_ado_token_escapes_single_quote() {
        let result = generate_acquire_ado_token(Some("my's-connection"), "SC_READ_TOKEN");
        assert!(
            result.contains("azureSubscription: 'my''s-connection'"),
            "Single quotes in service connection names must be doubled for YAML"
        );
    }

    ...would lock in this fix and prevent regressions.

  • src/compile/onees.rs:324 — unquoted serviceConnection value (pre-existing)

    Unrelated to this PR, but worth flagging while reviewing the area: format!("{}:\n serviceConnection: {}", name, sc) embeds the service connection name as a bare YAML scalar. A name containing :, #, or [ would produce invalid YAML. The same single-quote fix pattern applied to azureSubscription doesn't apply here (different quoting style), but wrapping the value in quotes (and escaping appropriately) would make this equally robust. Consider a follow-up issue.

✅ What Looks Good

  • The doc comment removal is clean — the two generate_schedule lines were clearly orphaned from a previous refactor.
  • The YAML escaping logic ('' doubling inside single-quoted scalars) is exactly correct per the YAML 1.2 spec.
  • sanitize_config correctly strips ##vso[ injection but preserves ' characters (by design), so reaching generate_acquire_ado_token with a quote in the name is a legitimate runtime path — the fix addresses the right layer.

Generated by Rust PR Reviewer for issue #229 · ● 782.6K ·

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant