Skip to content

ci: add QA protocol enforcement checks#138

Open
catchmeifyoucaan wants to merge 3 commits into
mainfrom
ci/qa-protocol-enforcement
Open

ci: add QA protocol enforcement checks#138
catchmeifyoucaan wants to merge 3 commits into
mainfrom
ci/qa-protocol-enforcement

Conversation

@catchmeifyoucaan

@catchmeifyoucaan catchmeifyoucaan commented Jul 16, 2026

Copy link
Copy Markdown

Scope

Add organization QA workflow enforcement to Workstream CI and pin reusable workflows to immutable revisions.

Invariants

  • Workstream application behavior and data lifecycle are unchanged.
  • Existing backend checks remain enabled.

Design

Use the centralized Flow Research credential scanner and PR-template linter as reusable workflows.

Duplicate and idempotency review

CI checks are read-only and repeatable. No application writes or data migrations are introduced.

Privacy and security review

Reusable workflow references are pinned to reviewed commit SHAs. Credential scanning remains enforced.

Verification

  • Parsed modified workflow YAML.
  • Completed internal workflow security review.
  • Credential scanner passed on the PR.

Summary by CodeRabbit

  • Chores
    • Improved pull request workflow filtering to run only on relevant activity types.
    • Added automated credential scanning for pull requests.
    • Added automated linting/validation of pull request descriptions against the project template.
  • Tests
    • Expanded the CI test flow to include isolated database runs and full-suite coverage reporting with stricter coverage gates.
    • Extended the CI test job time budget to accommodate the expanded test process.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The backend workflow now restricts pull-request activity types, runs isolated tests with scoped coverage thresholds, executes API contract tests through the isolated runner, and adds reusable credential scanning and pull-request template linting jobs.

Changes

Backend workflow validation

Layer / File(s) Summary
Rework isolated tests and coverage enforcement
.github/workflows/backend.yml
Removes the job-level test database URL, adds isolated database and full-suite test execution, and enforces targeted coverage thresholds.
Run API contract tests in isolation
.github/workflows/backend.yml
Runs the real API contract end-to-end test through the isolated test runner with WORKSTREAM_TEST_ADMIN_DATABASE_URL.
Add workflow validation jobs
.github/workflows/backend.yml
Restricts pull-request activity types and adds reusable credential scanning and pull-request-only template linting, passing the pull request body to the linter.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: abiorh001

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the goal and verification, but most required template sections like Chunk, Evidence, and reviewer results are missing. Add the missing template sections, especially Chunk, What Changed, Evidence, Test Delta, reviewer tables, and CI/gate integrity checkboxes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the CI QA workflow enforcement changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/qa-protocol-enforcement
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch ci/qa-protocol-enforcement

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94d53b6638

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/backend.yml Outdated

env:
WORKSTREAM_TEST_DATABASE_URL: postgresql+asyncpg://workstream:workstream@localhost:5433/workstream_test
WORKSTREAM_TEST_DATABASE_URL: postgresql+**********************************************/workstream_test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the async Postgres database URLs

In the GitHub Actions backend job, pytest reads WORKSTREAM_TEST_DATABASE_URL through backend/tests/conftest.py, and the API-contract step below validates WORKSTREAM_DATABASE_URL with assert_local_database_url. This replacement is not a SQLAlchemy/asyncpg URL at all (it has no ://, host, or credentials), so the first DB access or contract URL check on every CI run will fail instead of connecting to the Postgres service.

Useful? React with 👍 / 👎.

Comment thread .github/workflows/backend.yml Outdated

credential-scan:
name: Credential Scanner
uses: Flow-Research/.github/.github/workflows/credential-scanner.yml@ci/qa-protocol-enforcement

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pin reusable workflow references to SHAs

This new reusable workflow is referenced by the mutable branch ci/qa-protocol-enforcement (and the PR linter uses the same pattern), while this repo's PR checklist and existing workflow pattern require no unpinned new GitHub Action. If that branch moves or is deleted, Workstream CI can change or break without a reviewed commit in this repo; pin these reusable workflows to immutable commit SHAs.

Useful? React with 👍 / 👎.

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/backend.yml:
- Around line 70-75: Update the reusable workflow references in the
credential-scanner and pr-lint jobs to use full 40-character commit SHAs instead
of the mutable ci/qa-protocol-enforcement branch. Pin both Flow-Research/.github
workflow calls to the intended commit and preserve the existing workflow paths
and job behavior.
- Around line 68-70: Update the credential-scan job to declare the minimum
explicit GITHUB_TOKEN permissions required by the credential scanner, rather
than inheriting repository defaults, and replace the mutable reusable workflow
ref in the uses value with its immutable commit SHA. Preserve the existing
Flow-Research credential-scanner workflow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e1057705-4149-4840-9d1e-5493a411952b

📥 Commits

Reviewing files that changed from the base of the PR and between 9a04434 and a3e2433.

📒 Files selected for processing (1)
  • .github/workflows/backend.yml

Comment thread .github/workflows/backend.yml Outdated
Comment on lines +68 to +70
credential-scan:
name: Credential Scanner
uses: Flow-Research/.github/.github/workflows/credential-scanner.yml@ci/qa-protocol-enforcement

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== backend.yml excerpt ==\n'
sed -n '1,140p' .github/workflows/backend.yml

printf '\n== reusable workflow reference search ==\n'
rg -n "credential-scanner.yml|ci/qa-protocol-enforcement|permissions:" .github/workflows .github -S

Repository: Flow-Research/workstream

Length of output: 3124


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== backend.yml full file with line numbers ==\n'
cat -n .github/workflows/backend.yml | sed -n '1,180p'

Repository: Flow-Research/workstream

Length of output: 2913


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== locate referenced reusable workflow in repo metadata ==\n'
rg -n "credential-scanner.yml" -S .

Repository: Flow-Research/workstream

Length of output: 222


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== inspect git status and diff stat for workflow files ==\n'
git status --short
git diff --stat -- .github/workflows/backend.yml .github/workflows

Repository: Flow-Research/workstream

Length of output: 221


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== show any workflow-level permissions in backend.yml ==\n'
python3 - <<'PY'
from pathlib import Path
p = Path('.github/workflows/backend.yml')
text = p.read_text()
for i, line in enumerate(text.splitlines(), 1):
    if 'permissions:' in line or 'uses:' in line or 'credential-scan' in line:
        print(f"{i}: {line}")
PY

Repository: Flow-Research/workstream

Length of output: 607


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== check whether the external ref is a branch or tag name in GitHub semantics is not possible locally; inspect for other pins ==\n'
rg -n "`@ci/qa-protocol-enforcement`|`@main`|`@master`|`@v`[0-9]" .github/workflows -S

Repository: Flow-Research/workstream

Length of output: 558


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== candidate lines around 68-77 ==\n'
nl -ba .github/workflows/backend.yml | sed -n '60,90p'

Repository: Flow-Research/workstream

Length of output: 238


🏁 Script executed:

#!/bin/bash
set -euo pipefail
nl -ba .github/workflows/backend.yml | sed -n '1,120p'

Repository: Flow-Research/workstream

Length of output: 202


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in .github/workflows/agent-gates.yml .github/workflows/loop-memory.yml; do
  printf '\n== %s ==\n' "$f"
  sed -n '1,140p' "$f"
done

Repository: Flow-Research/workstream

Length of output: 1639


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
for path in [Path('.github/workflows/agent-gates.yml'), Path('.github/workflows/loop-memory.yml')]:
    print(f"\n== {path} permissions/uses lines ==")
    for i, line in enumerate(path.read_text().splitlines(), 1):
        if 'permissions:' in line or 'uses:' in line:
            print(f"{i}: {line}")
PY

Repository: Flow-Research/workstream

Length of output: 474


Add explicit permissions to credential-scan and pin the reusable workflow ref.
The job currently inherits repository defaults, and @ci/qa-protocol-enforcement is not pinned to an immutable commit. Use the minimum token scope this scanner needs.

🧰 Tools
🪛 zizmor (1.26.1)

[warning] 68-70: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/backend.yml around lines 68 - 70, Update the
credential-scan job to declare the minimum explicit GITHUB_TOKEN permissions
required by the credential scanner, rather than inheriting repository defaults,
and replace the mutable reusable workflow ref in the uses value with its
immutable commit SHA. Preserve the existing Flow-Research credential-scanner
workflow.

Source: Linters/SAST tools

Comment thread .github/workflows/backend.yml Outdated
@catchmeifyoucaan
catchmeifyoucaan marked this pull request as draft July 18, 2026 08:26
@catchmeifyoucaan
catchmeifyoucaan marked this pull request as ready for review July 18, 2026 08:27

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5605c721b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

WORKSTREAM_DATABASE_URL: postgresql+asyncpg://workstream:workstream@localhost:5433/workstream_test
run: python scripts/api_contract_e2e.py

credential-scan:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add internal review evidence for workflow changes

For a PR consisting of this workflow update, the pre-existing Internal review evidence gate step in this same workflow still runs before tests and scripts/check_internal_review_evidence.py treats .github/ changes as requiring evidence. Since this commit changes only .github/workflows/backend.yml and adds no .agent-loop/initiatives/.../*-internal-review-evidence.md, running the gate now exits 1 with required tracks senior engineering, qa/test, security/auth, product/ops, ci integrity, so the backend workflow will block the PR before reaching the new checks.

Useful? React with 👍 / 👎.

@abiorh-claw

Copy link
Copy Markdown
Collaborator

@catchmeifyoucaan please fix the conflict and add me to the reviewer in other to merge the PR

@catchmeifyoucaan

Copy link
Copy Markdown
Author

Closing and reopening to trigger CI run

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/backend.yml:
- Around line 11-13: Update the test job definition in the workflow to
explicitly declare read-only permissions, using the minimum required scope
rather than inheriting repository defaults. Keep the existing runner and timeout
configuration unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a3439ac-8ba3-44ec-8c0a-05e85b085c03

📥 Commits

Reviewing files that changed from the base of the PR and between 5605c72 and dbea1cd.

📒 Files selected for processing (1)
  • .github/workflows/backend.yml

Comment on lines 11 to +13
test:
runs-on: ubuntu-latest
timeout-minutes: 240

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Explicitly restrict the test job to read-only permissions.

The job inherits repository defaults, so the workflow does not guarantee the stated read-only behavior. Declare the minimum scope explicitly.

🔒 Proposed fix
   test:
+    permissions:
+      contents: read
     runs-on: ubuntu-latest
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test:
runs-on: ubuntu-latest
timeout-minutes: 240
test:
permissions:
contents: read
runs-on: ubuntu-latest
timeout-minutes: 240
🧰 Tools
🪛 zizmor (1.26.1)

[warning] 11-143: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/backend.yml around lines 11 - 13, Update the test job
definition in the workflow to explicitly declare read-only permissions, using
the minimum required scope rather than inheriting repository defaults. Keep the
existing runner and timeout configuration unchanged.

Source: Linters/SAST tools

catchmeifyoucaan and others added 2 commits July 18, 2026 15:30
Wires two reusable workflows from Flow-Research/.github:
- credential-scanner: flags plaintext credentials in source files
- pr-template-linter: validates PR body has required sections from template
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@catchmeifyoucaan
catchmeifyoucaan force-pushed the ci/qa-protocol-enforcement branch from dbea1cd to d4c8fb2 Compare July 18, 2026 14:31
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
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