Skip to content

ci(holmes): detect schema and wire outputs - #323

Closed
flyingrobots wants to merge 1 commit into
mainfrom
ci/holmes-detect-schema-2025-10-27
Closed

flyingrobots wants to merge 1 commit into
mainfrom
ci/holmes-detect-schema-2025-10-27

Conversation

@flyingrobots

Copy link
Copy Markdown
Owner

Extracted from #214: add a schema detection step and expose bundle_dir/schema via step outputs for later wiring. No behavior change yet; a follow-up PR can switch downstream steps to use needs.wesley-generate.outputs. Partial extraction to reduce scope and unblock CI refinement.

@coderabbitai

coderabbitai Bot commented Oct 27, 2025 •

Copy link
Copy Markdown

Summary by CodeRabbit

  • Chores
    • Enhanced CI workflow to improve GraphQL schema detection during builds. The workflow now automatically identifies the appropriate schema file based on configuration or file discovery, streamlining the build process.

PR Review

Walkthrough

A new CI workflow step "🕵️ Detect Schema" added to .github/workflows/wesley-holmes.yml that automatically detects the GraphQL schema file to use. The step checks for WESLEY_SCHEMA environment variable, enumerates GraphQL files with preference ordering, derives base_dir and bundle_dir paths, then exposes these via GITHUB_OUTPUT for downstream jobs.

Changes

Cohort / File(s) Summary
CI Workflow Schema Detection
\\.github/workflows/wesley-holmes.yml
Adds "🕵️ Detect Schema" step that implements schema auto-detection logic: validates WESLEY_SCHEMA env var, enumerates .graphql files with fallback to HOLMES_SCHEMA, computes base_dir and bundle_dir paths, exports schema and bundle_dir outputs with diagnostic logging

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Attention point: Schema fallback chain logic—verify the precedence order (WESLEY_SCHEMA file check → enumerate GraphQL files → schema.graphql preference → first file → HOLMES_SCHEMA) is correct and handles edge cases (no GraphQL files, broken symlinks, permission issues)
  • Attention point: Ensure GITHUB_OUTPUT export format is compatible with downstream job inputs and variable interpolation

Possibly related issues


🎯 A Schema Finds Its Home

Wesley's eye once blind, now sees—
GraphQL files dance with ease,
From env var to bundled grace,
Auto-detection finds its place! 📦✨


Listen, you've added a shell script fragment to your workflow that tries to be clever about finding schema files. Fine. The logic looks straightforward enough—check env var, walk the repo, sort by preference. But I have questions:

  1. What happens if someone has 50 GraphQL files? Does your script just pick the first alphabetically? That's asking for trouble. Document it or use explicit configuration.

  2. Error handling is sketchy. What if base_dir derivation fails? What if there's no readable .graphql file? Your diagnostics are nice but won't catch silent failures. Use set -e properly.

  3. The bundle_dir computation needs scrutiny. You're hardcoding .wesley as a subdirectory. Is that always safe? What about path traversal or symlink attacks?

  4. Output format matters. Make absolutely sure your GITHUB_OUTPUT usage aligns with GitHub's documented format. Spaces, quotes, special chars—one slip and your workflow silently breaks.

The change is minimal and incremental, which is good. No needless refactoring. No breaking changes. But minimal doesn't mean bulletproof.

Test this properly. Edge cases everywhere.

BunBun

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The provided description is a single paragraph that touches on context (extracted from #214), the core change (schema detection, output exposure), and intent (reduce scope for CI refinement), but it completely abandons the required template structure. The description lacks critical sections: no explicit Rationale & Alternatives, no Risks analysis for a CI workflow modification, no Backout Plan, no Checklist. For a change affecting the build pipeline, this is largely incomplete against the repository's standards. The description is coherent and on-topic, but structurally insufficient. Rewrite the PR description following the template provided in your repository. Explicitly address the Risks section—document what could break if this schema detection logic fails or selects the wrong file. Provide a Backout Plan explaining how to safely revert if the new workflow step causes issues. Include the Checklist to confirm tests pass locally and no secrets/permissions are inadvertently exposed in the workflow. A single paragraph hand-waving about scope reduction doesn't cut it when you're modifying build infrastructure.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "ci(holmes): detect schema and wire outputs" directly corresponds to the primary change in this PR—adding a schema detection step to the CI workflow and exposing bundle_dir/schema outputs. The commit convention format is professional, the language is specific and descriptive, and it avoids vague terminology. A reviewer scanning the git history would immediately understand this introduces schema detection plumbing to the CI system.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/holmes-detect-schema-2025-10-27

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🚢 SHIPME

[REALM] PASS — sha 678af21

@github-actions

Copy link
Copy Markdown

🔍 The Case of Pull Request #323

🕵️ SHA-lock HOLMES's Investigation

🕵️ SHA-lock HOLMES Investigation

  • Generated: 2025-10-27T09:10:15.273Z
  • Commit SHA: 678af21
  • Bundle Version: 2.0.0

⚠️ Evidence valid only for commit 678af21

🔍 Executive Deduction

"Watson, after careful examination of the evidence, I deduce..."

Weighted Completion: ██████░░░░ 60.0%
Scores: SCS 60.0% · TCI 70.0% · MRI 20.0%
Weight Config: defaults
Verification Status: 2 claims verified
Ship Verdict: REQUIRES INVESTIGATION

🧮 Score Breakdown

Schema Coverage (SCS)

Component Score Coverage
Sql 60.0% 60.0% (0.6/1.0)
Types 60.0% 60.0% (0.6/1.0)
Validation 60.0% 60.0% (0.6/1.0)
Tests 70.0% 70.0% (0.7/1.0)

Test Confidence (TCI)

Component Score Coverage Notes
Unit Constraints 70.0% 70.0% (0.7/1.0) —
Rls 70.0% 70.0% (0.7/1.0) —
Integration Relations 70.0% 70.0% (0.7/1.0) —
E2e Ops 70.0% 70.0% (0.7/1.0) —

Migration Risk (MRI)

Risk Vector Score Contribution Points
Drops 20.0% 100.0% 20.0
Renames 0.0% 0.0% 0.0
Defaults 0.0% 0.0% 0.0
Type Changes 0.0% 0.0% 0.0
Indexes 0.0% 0.0% 0.0
Other 0.0% 0.0% 0.0

📊 The Weight of Evidence

"Observe, Watson, how not all features carry equal importance..."

Element Weight Source Status Evidence Deduction
schema 5 Default ✅ SQL & tests out/schema.sql:1-9999@678af21 Elementary!

🚪 Security & Performance Gates

"Elementary security measures, Watson..."

Gate Status Evidence Holmes's Ruling
Migration Risk ✅ MRI: 20.0% "Acceptable risk"
Test Coverage ⚠️ TCI: 70.0% "Insufficient coverage"
Sensitive Fields ✅ 0 fields "All secured"

📋 The Verdict

⚠️ REQUIRES FURTHER INVESTIGATION
"Some clues remain unclear. Address the noted issues."

Signed and sealed,

  • S. Holmes, Consulting Detective

[END OF INVESTIGATION FOR COMMIT 678af21]


🩺 Dr. WATSON's Verification

🩺 Dr. Watson's Independent Verification Report

Medical Examination of Evidence

  • Examination Date: 2025-10-27T09:11:07.497Z
  • Patient SHA: 678af21

🔬 Citation Verification

"Let me examine each piece of evidence independently..."

  • Citations Examined: 2
  • Verified: 0 ✅
  • Failed: 0 ❌
  • Unable to Verify: 2

Verification Rate: 0.0%

📊 Mathematical Verification

"I shall recalculate Holmes's arithmetic..."

Holmes claimed SCS: 60.0%
Watson calculates: 100.0%
Difference: ⚠️ Significant

🔍 Consistency Analysis

"Checking for contradictions in Holmes's deductions..."

✅ No logical inconsistencies detected

🩺 Dr. Watson's Medical Opinion

VERIFICATION: CONCERNS NOTED ⚠️

"While Holmes's methods are generally sound, I have noted some"
"discrepancies that warrant further investigation."

Respectfully submitted,

  • Dr. J. Watson, M.D.
    Medical Examiner & Verification Specialist

🔮 Professor MORIARTY's Predictions

🧠 Professor Moriarty's Temporal Predictions

The Mathematics of Inevitability

  • Analysis Date: 2025-10-27T09:11:33.978Z

🔮 Current State

SCS: ██████░░░░ 60.0%
TCI: ███████░░░ 70.0%
MRI: 20.0% risk

📈 Velocity Analysis

SCS Velocity: +0.00%/day
⚠️ PLATEAU DETECTED - Progress has stalled!

⏰ Completion Predictions

ETA: Cannot predict (insufficient velocity)

"At current velocity, completion is... improbable."

📊 Historical Trajectory

10-27: ██████░░░░ 60.0%
10-27: ██████░░░░ 60.0%
10-27: ██████░░░░ 60.0%

"Every problem becomes elementary when reduced to mathematics"
— Professor Moriarty


Machine-readable reports: holmes-report.json · watson-report.json · moriarty-report.json (see workflow artifacts).


Filed at 221B Repository Street

@flyingrobots

Copy link
Copy Markdown
Owner Author

@coderabbitai review please

@coderabbitai

coderabbitai Bot commented Oct 27, 2025

Copy link
Copy Markdown

From: Linus Torvalds torvalds@linux-foundation.org
To: flyingrobots
Cc: code-rabbit@vger.kernel.org

@flyingrobots

Fine. I'll review your schema detection plumbing. This better be clean extraction work with no hidden behavioral landmines, or we're going to have words about scope creep.

Initiating review now.

BunBun

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a29ca9f and d99dda0.

📒 Files selected for processing (1)
  • .github/workflows/wesley-holmes.yml (1 hunks)
🔇 Additional comments (1)
.github/workflows/wesley-holmes.yml (1)

43-50: ---

The detect step outputs are never consumed; the concern is based on a false premise.

All downstream jobs (holmes-setup actions on lines 53, 90, 133, 181) hardcode schema: ${{ env.HOLMES_SCHEMA }} and bundle-dir: ${{ env.HOLMES_BUNDLE_DIR }}. The schema and bundle_dir outputs from the detect step at lines 48–49 are never referenced anywhere in the workflow—they're dead code.

Since HOLMES_SCHEMA is defined at workflow scope (line 11) as test/fixtures/examples/ecommerce.graphql (a committed test fixture), there is no silent failure risk to downstream jobs. The detect step runs, computes an unused path, and exits cleanly; nothing propagates a bogus schema.

Adding validation to the detect step is harmless defensive programming and makes sense if the step is intended for future use or visibility. But the stated risk—that invalid schema will corrupt downstream execution—does not actually occur.


From: Linus Torvalds torvalds@linux-foundation.org
To: {PR_AUTHOR_NAME} <{PR_AUTHOR_EMAIL}>
Cc: code-rabbit@vger.kernel.org

The reviewer is chasing ghosts. The detect step outputs are orphaned—never consumed by any downstream job. They might as well be /dev/null. The actual workflow uses hardcoded env vars that point to a committed test fixture. There's no pathway for invalid schema to propagate downstream.

If you want to add validation anyway as defensive belt-and-suspenders, fine—that's sensible practice. But don't mistake good hygiene for a critical bug. They're different things.

BunBun

Likely an incorrect or invalid review comment.

Comment on lines +27 to +50
- name: "🕵️ Detect Schema"
id: detect
shell: bash
run: |
set -euo pipefail
if [ -n "${WESLEY_SCHEMA:-}" ] && [ -f "$WESLEY_SCHEMA" ]; then
schema="$WESLEY_SCHEMA"
else
mapfile -t files < <(git ls-files "**/*.graphql" 2>/dev/null || true)
picked=""
if [ ${#files[@]} -gt 0 ]; then
for f in "${files[@]}"; do
if [ "${f##*/}" = "schema.graphql" ]; then picked="$f"; break; fi
done
if [ -z "$picked" ]; then picked="${files[0]}"; fi
fi
schema="${picked:-$HOLMES_SCHEMA}"
fi
base_dir="$(dirname "$schema")"
bundle_dir="$base_dir/.wesley"
echo "schema=$schema" >> "$GITHUB_OUTPUT"
echo "bundle_dir=$bundle_dir" >> "$GITHUB_OUTPUT"
echo "Detected schema: $schema"
echo "Bundle dir: $bundle_dir"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Step outputs not exposed at job level—job-level outputs: section missing.

To make outputs available to downstream jobs via needs.<job_id>.outputs, you must define job-level outputs that map to step outputs. Currently, the detect step writes to GITHUB_OUTPUT, but the wesley-generate job (lines 17–20) lacks an outputs: block to expose them.

Without job-level outputs:, downstream jobs like holmes-investigate (line 96) cannot access the detected schema/bundle_dir via needs.wesley-generate.outputs.*—they remain hardcoded to the env vars (lines 105–109). Per the PR description, this is intended as scaffolding for a follow-up, but to fulfill the stated goal of "expose bundle_dir/schema via step outputs for later wiring," you need to add:

  wesley-generate:
    name: "🚀 Wesley Generation"
    runs-on: ubuntu-latest
+   outputs:
+     schema: ${{ steps.detect.outputs.schema }}
+     bundle_dir: ${{ steps.detect.outputs.bundle_dir }}
    
    steps:

Then downstream jobs can reference ${{ needs.wesley-generate.outputs.schema }} etc. Verify this aligns with the extraction scope: is this deferred to the follow-up PR intentionally, or should it be included now?


🏁 Script executed:

#!/bin/bash
# Verify the structure of wesley-holmes.yml workflow
echo "=== Workflow file structure ==="
cat .github/workflows/wesley-holmes.yml

Length of output: 19381


🏁 Script executed:

#!/bin/bash
# Check for job-level outputs in wesley-generate job
echo "=== Checking wesley-generate job for outputs section ==="
grep -n -A 20 "wesley-generate:" .github/workflows/wesley-holmes.yml | head -30

Length of output: 716


🏁 Script executed:

#!/bin/bash
# Check downstream job references (holmes-investigate)
echo "=== Checking holmes-investigate job (line ~96) ==="
grep -n -A 15 "holmes-investigate:" .github/workflows/wesley-holmes.yml

Length of output: 603


🏁 Script executed:

#!/bin/bash
# Search for env var usage in downstream jobs
echo "=== Checking for hardcoded env vars ==="
grep -n "WESLEY_SCHEMA\|HOLMES_SCHEMA" .github/workflows/wesley-holmes.yml

Length of output: 656


🏁 Script executed:

#!/bin/bash
# Check if any downstream jobs reference needs.wesley-generate.outputs
echo "=== Checking for needs.wesley-generate.outputs references ==="
grep -n "needs\.wesley-generate\.outputs" .github/workflows/wesley-holmes.yml || echo "No references found"

Length of output: 81



Job-level outputs: block missing—wiring is incomplete.

The detect step correctly outputs schema and bundle_dir to GITHUB_OUTPUT (lines 51–52), but these outputs are not exposed at the job level. Without a job-level outputs: block on wesley-generate, downstream jobs cannot access these values via the needs context—they're stuck using hardcoded ${{ env.HOLMES_SCHEMA }} and ${{ env.HOLMES_BUNDLE_DIR }} (confirmed across holmes-investigate, watson-verify, moriarty-predict, test-pgtap).

This breaks the stated extraction goal. Add this to wesley-generate (after line 19):

  wesley-generate:
    name: "🚀 Wesley Generation"
    runs-on: ubuntu-latest
+   outputs:
+     schema: ${{ steps.detect.outputs.schema }}
+     bundle_dir: ${{ steps.detect.outputs.bundle_dir }}
    
    steps:

The follow-up PR can then switch downstream jobs to ${{ needs.wesley-generate.outputs.schema }} instead of hardcoded env vars. This needs to be in this PR to avoid dangling scaffolding.


BunBun

Committable suggestion skipped: line range outside the PR's diff.

@flyingrobots

Copy link
Copy Markdown
Owner Author

Consolidated into integration PR #334 (integration/holmes-2025-10-27 → main). Keeping all changes via merge commits; original PR closed to reduce noise.

@flyingrobots
flyingrobots deleted the ci/holmes-detect-schema-2025-10-27 branch October 27, 2025 23:54
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