Skip to content

Extract JavaScript program metrics from run prompts in audit analysis - #48993

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/extract-javascript-programs
Closed

Extract JavaScript program metrics from run prompts in audit analysis#48993
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/extract-javascript-programs

Conversation

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Issue reports from ambient-context runs relied on prompt.txt fallback data but could not quantify embedded JavaScript programs, making it harder to identify repeated high-cost prompt fragments. This change adds language-aware code-block extraction so audit data can report JS-specific prompt overhead directly.

  • Prompt analysis model expansion

    • PromptAnalysis now includes:
      • code_blocks_by_language
      • javascript_programs
      • javascript_total_size
  • Markdown fenced-code extraction in audit pipeline

    • extractPromptAnalysis now parses fenced blocks from prompt.txt content.
    • Supports both backtick and tilde fences.
    • Normalizes language tags and counts per-language blocks.
    • Aggregates JS payload size for js/javascript blocks only.
  • Audit output quality improvement

    • Prompt analysis now surfaces language-level breakdown instead of only total prompt bytes.
    • Enables direct attribution of prompt bloat to repeated JS examples/programs in sampled runs.
analysis := &PromptAnalysis{
    PromptSize: len(data),
    PromptFile: relPromptPath,
}
populatePromptCodeBlockAnalysis(string(data), analysis)
// analysis.JavaScriptPrograms / analysis.JavaScriptTotalSize now populated

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Extract JavaScript code blocks in audit prompt analysis Extract JavaScript program metrics from run prompts in audit analysis Jul 29, 2026
Copilot AI requested a review from pelikhan July 29, 2026 22:13
@pelikhan pelikhan closed this Jul 29, 2026
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.

2 participants