Skip to content

Internal workflow to see docs impact from committed modifications#910

Open
LasmarKhalifa wants to merge 3 commits into
mainfrom
05-26/branch-docs-impact-workflow
Open

Internal workflow to see docs impact from committed modifications#910
LasmarKhalifa wants to merge 3 commits into
mainfrom
05-26/branch-docs-impact-workflow

Conversation

@LasmarKhalifa
Copy link
Copy Markdown
Contributor

@LasmarKhalifa LasmarKhalifa commented Jun 1, 2026

tldr; Adds a workflow that takes committed changes on a branch, and analyzes their impact on Roast's docs.

If the -- fix argument is passed, automatic fixes will be applied.

This was placed under internal/workflows/maintenance

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@LasmarKhalifa LasmarKhalifa force-pushed the 05-26/branch-docs-impact-workflow branch from 865467a to 0250540 Compare June 1, 2026 21:38
@LasmarKhalifa LasmarKhalifa changed the title workflow to see docs impact from current branch modifications Internal workflow to see docs impact from current branch modifications Jun 1, 2026
@LasmarKhalifa LasmarKhalifa changed the title Internal workflow to see docs impact from current branch modifications Internal workflow to see docs impact from committed modifications Jun 1, 2026
@LasmarKhalifa LasmarKhalifa marked this pull request as ready for review June 1, 2026 21:48
Copy link
Copy Markdown
Contributor

@dersam dersam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything specific to Roast in this workflow. Can we add it to examples and provide functional tests for it so anyone can reuse it?

Copy link
Copy Markdown
Contributor

@juniper-shopify juniper-shopify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of suggestions for enhancements, but this is good to go in my opinion as a first phase


#: self as Roast::Workflow

# Gets the committed diff of the current branch vs origin/main, then analyzes it for potential
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider looking at the graphite branch's parent branch instead of always main


agent(:analyzer) do
skip! if cmd!(:diff).text.strip.empty?
fail!("diff too large (#{cmd!(:diff).text.bytesize} bytes) to analyze — narrow the branch or exclude generated files") if cmd!(:diff).text.bytesize > 500_000
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice edge case to check! Consider adding a force arg to bypass it? Or a max_diff_size kwarg to override the default and 0 is unlimited?

Rules:
- Use ONLY the diff below. Do not run any commands.
- Be thorough about finding real issues — do not be conservative.
- But do NOT speculate about docs you cannot see in the diff.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be good to have it look at the code diff vs all the docs? not just changed docs?

skip! if agent!(:analyzer).response.strip == "No documentation impact."
<<~PROMPT
Apply the documentation fixes suggested in the analysis below. Edit the
affected files in place. Do not modify any code files; docs only.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would want it to modify method and class doc comments in code files, though, right?

Apply the documentation fixes suggested in the analysis below. Edit the
affected files in place. Do not modify any code files; docs only.

#{agent!(:analyzer).response}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just resume from the analyzer's session

do my.session = agent!(:analyzer.session) before the prompt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still include the report in your prompt, potentially, to be extra precise about what you want, though

puts "Files considered (#{files.size}):"
files.each { |f| puts " #{f}" }
puts "ANALYSIS:\n#{chat!(:report).response}"
puts(agent?(:fixer) ? "Fixes applied." : "(Next time, run with `-- fix` to auto-apply suggested edits)")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth storing some report data/metadata so that when you run with fix right after a dry run it doesn't have to re-analyze

@juniper-shopify
Copy link
Copy Markdown
Contributor

Can we add it to examples

I'm not sure I'd want our internal maintenance workflows to live in the examples/ directory. I've been intentionally trying to establish an internal documentation and workflows directory structure for this kind of thing, and I expect we'll have more going forward. We can have notes in the READMEs pointing people to them as additional examples, though. That's a good idea

@juniper-shopify
Copy link
Copy Markdown
Contributor

juniper-shopify commented Jun 2, 2026

provide functional tests for it

This is a good idea to do regardless. Workflows that we use for internal maintenance should ideally be tested

I would do this as a follow-up PR after the full stack of PRs building this workflow out is merged, though.

@dersam
Copy link
Copy Markdown
Contributor

dersam commented Jun 2, 2026

Can we add it to examples

I'm not sure I'd want our internal maintenance workflows to live in the examples/ directory. I've been intentionally trying to establish an internal documentation and workflows directory structure for this kind of thing, and I expect we'll have more going forward. We can have notes in the READMEs pointing people to them as additional examples, though. That's a good idea

Makes sense to me.

@LasmarKhalifa LasmarKhalifa force-pushed the 05-26/branch-docs-impact-workflow branch from 0250540 to ee00173 Compare June 2, 2026 17:21
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.

3 participants