-
Notifications
You must be signed in to change notification settings - Fork 4
TEMP: scratch workflow for investigate-prompt iteration #662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+107
−0
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
1d8ba2d
Add temporary scratch workflow for iterating on the investigate-failu…
JakeSCahill 3b1d495
Switch temp workflow trigger to pull_request so it runs on PR #662 wi…
JakeSCahill 6c64bca
Add workflow_dispatch back now that the workflow is registered
JakeSCahill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: TEMP - Investigate-prompt iteration (delete after use) | ||
|
|
||
| # Scratch workflow for iterating on the "Investigate failure with Claude" | ||
| # prompt used in doc-detective-screenshots.yml. Deliberately breaks a real | ||
| # selector to produce a genuine, realistic failure, then runs the exact | ||
| # investigate-prompt logic against it so we can judge diagnosis/fix quality | ||
| # without waiting on a real failure or merging the real workflow changes. | ||
| # Delete this file once a good prompt is found — it is not meant to be | ||
| # long-lived. | ||
|
|
||
| on: | ||
| workflow_dispatch: {} | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/_temp-test-investigate-prompt.yml' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| test-investigate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: true | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Create .env file for preprod | ||
| run: | | ||
| echo "CLOUD_BASE_URL=https://preprod--redpanda-cloud.netlify.app" >> tests/doc-detective/.env | ||
| echo "CLOUD_LOGIN_EMAIL=${{ secrets.PREPROD_EMAIL }}" >> tests/doc-detective/.env | ||
| echo "CLOUD_LOGIN_PASSWORD=${{ secrets.PREPROD_PASSWORD }}" >> tests/doc-detective/.env | ||
| echo "CLOUD_CLUSTER_ID=d9f1nf0d6v8fd1orsa00" >> tests/doc-detective/.env | ||
|
|
||
| # Deliberately breaks one real step so the test fails for a plausible, | ||
| # realistic reason (a UI label changing) — never committed, only exists | ||
| # in this ephemeral checkout. | ||
| - name: Deliberately break a selector to create a realistic failure | ||
| run: | | ||
| sed -i 's/"elementText":"Add input"/"elementText":"Add Input Source"/' modules/develop/pages/connect/connect-quickstart.adoc | ||
| grep -n "Add Input Source" modules/develop/pages/connect/connect-quickstart.adoc | ||
|
JakeSCahill marked this conversation as resolved.
|
||
|
|
||
| - name: Run inline tests (expected to fail) | ||
| id: run_tests | ||
| continue-on-error: true | ||
| run: node tests/doc-detective/run-inline.js | ||
|
|
||
| - name: Investigate failure with Claude | ||
| if: steps.run_tests.outcome == 'failure' | ||
| env: | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| ENVIRONMENT: preprod | ||
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| REPO: ${{ github.repository }} | ||
| run: | | ||
| cat > /tmp/investigate-prompt.md <<PROMPT | ||
| A Doc Detective test failed in this repo's Cloud console screenshot-testing framework, for the **${ENVIRONMENT}** environment. Run: ${RUN_URL} | ||
|
|
||
| ## Context to read first | ||
|
|
||
| - tests/doc-detective/README.md — how this whole system works, including known gotchas (a real AsciiDoc passthrough-macro bug, a non-greedy inline-comment parser, a \$HOME/\$END token collision) that have caused real failures before. Check these before assuming a selector problem. | ||
| - tests/doc-detective/last-inline-report.json — this run's result, already redacted of credentials. Find the FAIL/SKIPPED step(s) and read \`resultDescription\`. | ||
| - modules/develop/pages/connect/connect-quickstart.adoc — the page under test (search for \`// (test\` / \`// (step\`). | ||
|
|
||
| ## Step 1: Reproduce | ||
|
|
||
| Run \`node tests/doc-detective/run-inline.js\` yourself (the ${ENVIRONMENT} .env is already in tests/doc-detective/.env from an earlier step in this job). Confirm you see the same failure. If it passes now, run it two more times before concluding anything — a single pass after one failure is not enough to call it transient. | ||
|
|
||
| ## Step 2: Diagnose — transient or real? | ||
|
|
||
| Decide which of these it is, and say so explicitly in whatever you produce next: | ||
|
|
||
| - **Transient**: flaky timing, a screenshot comparison that landed just over the variation threshold by chance, a one-off network blip, or (${ENVIRONMENT} == prod only) the canvas feature flag genuinely not shipped there yet (expected, documented in the workflow's own comments). | ||
| - **Real, fixable here**: a selector, button label, or UI text genuinely changed, and the .adoc file's steps/screenshot need updating to match. This is a normal doc/test maintenance fix. | ||
| - **Real, not fixable here**: an actual product regression, a broken environment, or anything where the right fix is outside this repo (product code, infra). Do not attempt to patch product behavior or paper over a real bug by loosening the test. | ||
|
|
||
| ## Step 3: Act on your diagnosis — exactly one of these | ||
|
|
||
| **A. Real and fixable** — make the minimal change to the .adoc file (selector, expected text, step wording only where the documented procedure itself changed) and/or let the screenshot step regenerate the screenshot. Then: | ||
| 1. Re-run \`node tests/doc-detective/run-inline.js\` again and confirm it now reports PASS with zero skipped. Do not open a PR on the strength of a guess — only after you've watched it pass. | ||
| 2. If a screenshot changed and is over 100KB, run \`node tests/doc-detective/fix-oversized-image.js <path>\` per the README's screenshot standards, and view the result before committing. | ||
| 3. Create a branch, commit exactly the files that needed to change (the .adoc file and/or the regenerated screenshot(s) — nothing unrelated), push it, and open a PR with \`gh pr create\`. The PR body must state: what failed, why (your diagnosis), what you changed, and that you personally re-ran the test and saw it pass. Include the before/after screenshot inline in the PR body if one changed. | ||
| 4. Label the PR \`doc-detective,${ENVIRONMENT},prompt-test\`. | ||
| 5. Never widen \`maxVariation\`, delete a step, or otherwise weaken what the test actually verifies just to make it pass — that defeats the point of it existing. | ||
|
|
||
| **B. Transient, or real-but-not-fixable-here** — do not open a PR. Instead, print a clear paragraph explaining your diagnosis (there is no real issue to close in this test run — just state what you would have said in the issue-close comment). | ||
|
|
||
| Produce exactly one outcome: a PR, or a printed diagnosis. Not both, not neither. | ||
| PROMPT | ||
|
JakeSCahill marked this conversation as resolved.
|
||
|
|
||
| claude -p "$(cat /tmp/investigate-prompt.md)" \ | ||
| --permission-mode bypassPermissions \ | ||
| --effort high \ | ||
| --output-format json \ | ||
| --max-budget-usd 3 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.