flowharness-ci-runner 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. flowharness_ci_runner-0.1.0/LICENSE +202 -0
  2. flowharness_ci_runner-0.1.0/PKG-INFO +274 -0
  3. flowharness_ci_runner-0.1.0/README.md +258 -0
  4. flowharness_ci_runner-0.1.0/pyproject.toml +40 -0
  5. flowharness_ci_runner-0.1.0/pyproject.toml.orig +57 -0
  6. flowharness_ci_runner-0.1.0/src/flowharness_ci/__init__.py +7 -0
  7. flowharness_ci_runner-0.1.0/src/flowharness_ci/baseline.py +176 -0
  8. flowharness_ci_runner-0.1.0/src/flowharness_ci/case_ref_guard.py +87 -0
  9. flowharness_ci_runner-0.1.0/src/flowharness_ci/cassette.py +28 -0
  10. flowharness_ci_runner-0.1.0/src/flowharness_ci/cli.py +589 -0
  11. flowharness_ci_runner-0.1.0/src/flowharness_ci/cli_args.py +167 -0
  12. flowharness_ci_runner-0.1.0/src/flowharness_ci/diffscope.py +252 -0
  13. flowharness_ci_runner-0.1.0/src/flowharness_ci/errors.py +26 -0
  14. flowharness_ci_runner-0.1.0/src/flowharness_ci/executor/__init__.py +6 -0
  15. flowharness_ci_runner-0.1.0/src/flowharness_ci/executor/ports.py +19 -0
  16. flowharness_ci_runner-0.1.0/src/flowharness_ci/executor/replay.py +183 -0
  17. flowharness_ci_runner-0.1.0/src/flowharness_ci/external_gate.py +167 -0
  18. flowharness_ci_runner-0.1.0/src/flowharness_ci/external_report.py +127 -0
  19. flowharness_ci_runner-0.1.0/src/flowharness_ci/gate.py +155 -0
  20. flowharness_ci_runner-0.1.0/src/flowharness_ci/gh_api.py +159 -0
  21. flowharness_ci_runner-0.1.0/src/flowharness_ci/git_env.py +25 -0
  22. flowharness_ci_runner-0.1.0/src/flowharness_ci/hook_install.py +193 -0
  23. flowharness_ci_runner-0.1.0/src/flowharness_ci/ingest_findings.py +593 -0
  24. flowharness_ci_runner-0.1.0/src/flowharness_ci/metrics.py +242 -0
  25. flowharness_ci_runner-0.1.0/src/flowharness_ci/py.typed +0 -0
  26. flowharness_ci_runner-0.1.0/src/flowharness_ci/remote/__init__.py +1 -0
  27. flowharness_ci_runner-0.1.0/src/flowharness_ci/remote/upload.py +350 -0
  28. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/__init__.py +8 -0
  29. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/display_units.py +118 -0
  30. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/external_section.py +167 -0
  31. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/json_report.py +20 -0
  32. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/markdown_safety.py +81 -0
  33. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/pr_comment.py +198 -0
  34. flowharness_ci_runner-0.1.0/src/flowharness_ci/render/run_report.py +128 -0
  35. flowharness_ci_runner-0.1.0/src/flowharness_ci/seed/__init__.py +86 -0
  36. flowharness_ci_runner-0.1.0/src/flowharness_ci/seed/io.py +209 -0
  37. flowharness_ci_runner-0.1.0/src/flowharness_ci/seed/plan.py +274 -0
  38. flowharness_ci_runner-0.1.0/src/flowharness_ci/seed/templates.py +172 -0
  39. flowharness_ci_runner-0.1.0/src/flowharness_ci/suite_lock.py +188 -0
  40. flowharness_ci_runner-0.1.0/src/flowharness_ci/surface_text.py +125 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,274 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowharness-ci-runner
3
+ Version: 0.1.0
4
+ Summary: flowharness CI runner — detect changed AI surfaces, resolve the committed suite lockfile, and load the local gate policy (local, deterministic, zero network)
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Requires-Dist: flowharness-core==0.1.0
11
+ Requires-Dist: flowharness-evaluation==0.1.0
12
+ Requires-Dist: flowharness-inspection==0.1.0
13
+ Requires-Python: >=3.12
14
+ Project-URL: Homepage, https://github.com/flowharness-ai
15
+ Description-Content-Type: text/markdown
16
+
17
+ # flowharness-ci-runner
18
+
19
+ The CI runner distribution (`flowharness-ci`). CI-PR6a ships the **read-the-world**
20
+ slice: detect changed AI surfaces, resolve the committed suite lockfile, and load the
21
+ local gate policy. Execution + scoring (the `CaseExecutor` port, replay cassettes, and
22
+ metrics) land in CI-PR6b.
23
+
24
+ > **Note:** these packages currently install top-level modules named `core`, `inspection`,
25
+ > `evaluation`, and `portability`. Prefer `uvx` (isolated environments) over `pip install`
26
+ > into a shared venv until the 0.2 module-namespace rename lands.
27
+
28
+ ## `vibe-check`
29
+
30
+ ```
31
+ flowharness-ci vibe-check [--base REF] [--suite PATH] [--gate-policy PATH]
32
+ [--executor replay|live] [--format table|json|github]
33
+ [--upload] [--baseline REF]
34
+ [--external-findings LIST] [--external-tool file=tool]
35
+ ```
36
+
37
+ - **No AI-surface change** -> prints `no AI-surface changes` and exits `0` (the fast path:
38
+ most PRs never start the job).
39
+ - **A surface changed** -> resolves `.flowharness/suite.lock.json` + the gate policy, then —
40
+ because execution is not yet wired (CI-PR6b) — emits `executor pending (CI-PR6b)` and exits
41
+ `1` (`NEEDS_HUMAN`). It is never a silent PASS.
42
+ - `--executor live` is accepted but refused with a clear message (CI-PR9). `--upload` is now
43
+ **wired** (CI-PR8) — see [Tier 1 ingestion](#tier-1-ingestion---upload-ci-pr8) below.
44
+ - `--external-findings a.sarif,b.json` merges third-party scanner findings into the verdict through
45
+ the `[external]` gate (and `--external-tool a.sarif=snyk_agent_scan` pins a tool per file) — see
46
+ [`ingest-findings`](#ingest-findings) below (PR-P1.4).
47
+
48
+ ## Files it reads (fixtures-are-the-contract)
49
+
50
+ - `.flowharness/suite.lock.json` — schema `flowharness/ci-suite/v1`. Unknown/missing `schema`,
51
+ oversize input, or malformed JSON **fail closed** with a typed error.
52
+ - `.flowharness/gate-policy.toml` — optional. **Absent -> the safe default -> `NEEDS_HUMAN`**
53
+ (never auto-PASS an unconfigured repo). Commit one to opt into automation.
54
+
55
+ ## Tier 1 ingestion (`--upload`, CI-PR8)
56
+
57
+ `--upload` POSTs the signed governance run to a FlowHarness instance. It is **telemetry, never
58
+ judgment**: the exit code is ALWAYS the local verdict (PASS 0 / NEEDS_HUMAN 1 / FAIL 2), and no
59
+ upload outcome — success, failure, or misconfiguration — ever changes it. Every outcome is one
60
+ `notice:` line on **stderr**; stdout stays the byte-frozen artifact (so `--format json` output is
61
+ **byte-identical with and without `--upload`**).
62
+
63
+ **Configuration (env only — nothing secret is ever a CLI flag or on argv):**
64
+
65
+ - `FLOWHARNESS_TOKEN` — the raw HMAC key. Read from the environment ONLY (there is no `--token`
66
+ flag by construction); it is never logged, never in a repr, never in an error, on any path.
67
+ **Absent or empty ⇒ Tier 0**: the run succeeds locally and the upload is skipped with one
68
+ notice — never an error.
69
+ - `FLOWHARNESS_API_URL` — the instance base URL. An **allowlist**: only `https://`, plus
70
+ `http://` when the host is exactly `localhost` / `127.0.0.1` / `::1`. Every other scheme
71
+ (`ftp:`, `file:`, `data:`, `ws:`, schemeless) is refused before any request is built.
72
+ - `GITHUB_RUN_ID` / `GITHUB_RUN_ATTEMPT` — supply the idempotency nonce
73
+ (`runner_nonce = {run_id}-{attempt}`). Absent (a local run) ⇒ skipped with a notice.
74
+
75
+ **Tier ladder (D-CI8-7).** No `--upload` flag → nothing uploads. `--upload` with no token →
76
+ **Tier 0** skip. `--upload` with a token → **Tier 1**: exactly one signed POST to
77
+ `{FLOWHARNESS_API_URL}/v1/evaluation/runs`, then one of:
78
+
79
+ | Outcome | Meaning | Retried? |
80
+ | --- | --- | --- |
81
+ | `verified` | the server accepted and verified the signature | — |
82
+ | `duplicate` | the server already ingested this run (suite × candidate × cell × nonce, HTTP 409) | no (idempotent success) |
83
+ | `rejected` | the server stored the run `rejected` (HTTP 200) | **no — see below** |
84
+ | `failed` | transport error / 5xx / 429 after bounded retries, or a 4xx / 3xx | up to 3 attempts (5xx/429/transport only) |
85
+ | `skipped` | Tier 0, missing URL/nonce, or a refused URL | — |
86
+
87
+ **A `rejected` landing is the CORRECT, tamper-evident outcome — not a client bug.** The server
88
+ verifies an HMAC over exactly the bytes it re-derives from the report; if the signature does not
89
+ match, it stores the run `rejected` (HTTP 200) as an audit trail rather than erroring. The
90
+ runner **reports this faithfully and does NOT retry-to-force it** — retrying a `rejected` run
91
+ would defeat the tamper-evidence. If you see `rejected`, the token or the report bytes are the
92
+ place to look, not the runner.
93
+
94
+ **Transport hardening (security).** The token is the signing key, so the transport dials exactly
95
+ one address: it **refuses all redirects** (a 3xx is terminal — the bearer is never re-sent to a
96
+ `Location` target, cross-origin included) and **never honors ambient proxies** (`http_proxy` /
97
+ `HTTPS_PROXY` / `ALL_PROXY` and macOS system proxy config are ignored — the key travels only
98
+ toward `FLOWHARNESS_API_URL`). Each attempt has a 10 s idle timeout; the CI job's own timeout is
99
+ the total-wall backstop.
100
+
101
+ **Supply-chain residual (stated honestly, D-CI8-9).** In the composite action, scope
102
+ `FLOWHARNESS_TOKEN` / `FLOWHARNESS_API_URL` to the **vibe-check step's `env:`** — never the job
103
+ `env` (which would hand the HMAC key to every step, including PR-controlled setup steps). A
104
+ composite action's own internal steps (`astral-sh/setup-uv`, the `gh` comment step) still
105
+ inherit the invoking step's process env; that exposure is not client-fixable. Mitigations: pin
106
+ the action by SHA, and note the key's blast radius is one ingest endpoint, not a repo credential.
107
+
108
+ ## `ingest-findings`
109
+
110
+ ```
111
+ flowharness-ci ingest-findings --input findings.sarif
112
+ [--tool snyk_agent_scan|aguara|medusa|inkog|sarif_generic]
113
+ [--format table|json|github]
114
+ ```
115
+
116
+ Converts ONE third-party scanner artifact (SARIF or the tool's native JSON) into FlowHarness
117
+ findings and renders them — **standalone, no gate is applied**, so the exit code is `0` (converted)
118
+ or `2` (the artifact was malformed / oversize / unreadable — fail-closed). Use it to inspect what a
119
+ scanner would contribute before wiring it into `vibe-check --external-findings`.
120
+
121
+ - **Tool detection.** SARIF auto-detects the tool from every `tool.driver.name` (all `runs[]` are
122
+ read); `--tool` overrides it. Native (non-SARIF) JSON has no driver name, so `--tool` is required.
123
+ - **`--format`** — `table` (the collapsed `▸ Third-party checks` section), `json` (the byte-exact
124
+ `flowharness/ci-findings/v1` artifact), or `github` (the `::error file=…,line=…::` annotation stream).
125
+ - **Hardening.** A 256 KiB size cap before read, JSON-only parsing (no YAML), an iterative depth guard
126
+ against nesting bombs, and `redact_path` over every path/message before it enters a finding.
127
+
128
+ Findings map to `core.Severity` through **`external_severity_map.v1`** — the single authority in
129
+ `core`, shared with product/06 evidence intake later: SARIF `level` none/note→INFO, warning→WARN,
130
+ error→ERROR, with a SARIF `security-severity` value **≥ 9.0 lifting any finding to CRITICAL**;
131
+ per-tool native codes/levels for Snyk (`E###`→ERROR, curated-critical→CRITICAL, `W###`→WARN),
132
+ Aguara/Medusa (low/medium/high/critical), and Inkog (structural classes→ERROR); an unknown or absent
133
+ severity → WARN + a `severity_unmapped` marker. Every finding carries `third_party` provenance and
134
+ the `risk.external` dimension, and the path **never** touches `safety_score_bp`.
135
+
136
+ ### The `[external]` gate (`vibe-check --external-findings`)
137
+
138
+ `vibe-check --external-findings a.sarif,b.json [--external-tool a.sarif=snyk_agent_scan]` merges the
139
+ same artifacts into a run and gates them through an `[external]` table in
140
+ `.flowharness/gate-policy.toml`:
141
+
142
+ ```toml
143
+ [external]
144
+ max_critical = 0 # any external CRITICAL beyond this FAILs a configured repo
145
+ max_error = 5 # beyond this ⇒ NEEDS_HUMAN
146
+ unmapped_severities = "needs_human" # or "ignore"
147
+ ```
148
+
149
+ The external verdict combines with the eval verdict by precedence — `max(eval, external)` under
150
+ `FAIL > NEEDS_HUMAN > PASS`. **An absent `[external]` section is the safe default:** a CRITICAL
151
+ external finding on an unconfigured repo raises `NEEDS_HUMAN`, never `FAIL` (a FAIL requires an
152
+ explicitly committed policy). The external gate always runs, even on the fast path, so external
153
+ findings can never be silently bypassed; and a `vibe-check` run without `--external-findings`
154
+ produces a byte-identical `flowharness/ci-run/v1` artifact (additive wire).
155
+
156
+ ## Consumer packaging — the `vibe-check` composite action (§2.7)
157
+
158
+ Drop this workflow into a consumer repo. The action renders the run as a **sticky PR comment**
159
+ (create-or-update, keyed by a hidden `<!-- flowharness-vibe-check -->` marker, so re-pushes edit
160
+ ONE comment) and propagates the verdict exit code.
161
+
162
+ ```yaml
163
+ # .github/workflows/vibe-check.yml
164
+ name: FlowHarness Vibe Check
165
+ on:
166
+ pull_request: # the pull_request trigger ONLY — never its _target twin (S4)
167
+ paths: ["CLAUDE.md", ".claude/**", ".cursor/**", ".cursorrules", "AGENTS.md",
168
+ ".continue/**", ".opencode/**", "playbook/**", ".flowharness/**",
169
+ "**/crew*.py", "**/agents.y*ml", "**/tasks.y*ml"]
170
+ permissions:
171
+ contents: read
172
+ pull-requests: write # sticky comment only
173
+ jobs:
174
+ vibe-check:
175
+ runs-on: ubuntu-latest
176
+ steps:
177
+ - uses: actions/checkout@<40-hex-sha> # v6 — SHA-pin third-party actions (S7)
178
+ with: { fetch-depth: 0 } # diffscope needs the merge base
179
+ - uses: flowharness-ai/vibe-check-action@<40-hex-sha> # v1 — SHA-pin
180
+ with:
181
+ executor: replay # 'live' requires a provider key (CI-PR9)
182
+ upload: ${{ secrets.FLOWHARNESS_TOKEN != '' }} # Tier 1 iff a token is configured (CI-PR8)
183
+ env: # secret + URL on THIS step only — never job env, never with:
184
+ FLOWHARNESS_TOKEN: ${{ secrets.FLOWHARNESS_TOKEN }}
185
+ FLOWHARNESS_API_URL: ${{ vars.FLOWHARNESS_API_URL }}
186
+ ```
187
+
188
+ **Tier 1 upload (CI-PR8).** `upload: ${{ secrets.FLOWHARNESS_TOKEN != '' }}` opts a repo into
189
+ signed ingestion only once a token secret is set; the action forwards `--upload` to the CLI. Scope
190
+ `FLOWHARNESS_TOKEN` / `FLOWHARNESS_API_URL` to the **`env:` of this `uses:` step** — never the job
191
+ `env` (which would hand the HMAC key to every step of the job, PR-controlled setup steps included),
192
+ and never `with:` (which would echo the secret into the action's declared input surface). See the
193
+ [Tier 1 ingestion](#tier-1-ingestion---upload-ci-pr8) section for the tier ladder, outcomes, and
194
+ the honestly-stated composite-action residual (the action's own internal steps inherit this step's
195
+ env).
196
+
197
+ The `paths:` list mirrors the AI-surface set `inspection.domain.surfaces` classifies (spec
198
+ §2.7's own example): the exact root files (`CLAUDE.md`, `.cursorrules`, `AGENTS.md`), the
199
+ surface trees (`.claude/`, `.cursor/`, `.continue/`, `.opencode/`, `playbook/`), the
200
+ governance dir, and the orchestration globs. If the classifier gains a surface, add it here
201
+ too — a path missing from this list means changes to that surface never trigger the workflow
202
+ (the runner itself would still classify them on any run that does start).
203
+
204
+ **S7 — pin every third-party action by commit SHA**, with the tag in a trailing comment. The
205
+ in-repo action already pins `astral-sh/setup-uv` this way; do the same for `actions/checkout`
206
+ and the published action above.
207
+
208
+ **How the action runs the CLI (D-CI7-30).** `astral-sh/setup-uv` installs only the `uv`/`uvx`
209
+ binaries — it does NOT install this package's console script — so every CLI step in the action
210
+ runs `uvx --from flowharness-ci-runner flowharness-ci …`, the §2.7 fetch-and-run form. The
211
+ `--from` clause is required because the distribution name (`flowharness-ci-runner`) differs
212
+ from the script name (`flowharness-ci`); a bare `uvx flowharness-ci` would resolve the wrong
213
+ package. **Publication dependency:** `flowharness-ci-runner` must be published to PyPI before
214
+ the action is runnable anywhere — until then the vibe-check step fails at resolution (a
215
+ non-zero capture, so never a silent PASS). At first publication, pin the package
216
+ (`--from flowharness-ci-runner==X.Y.Z`) so a SHA-pinned action cannot float to a newer release.
217
+
218
+ **gh version floor: `>= 2.47`.** The action lists comments with plain `gh api --paginate`, which
219
+ for a top-level array endpoint (`/issues/{n}/comments`) splices the pages into ONE flat array —
220
+ MEASURED on gh 2.89.0 against a local three-page server: `json.loads` yields 5 flat items across
221
+ 3 pages, and `--paginate` auto-sets `per_page=100`, so the marker comment is found even off the
222
+ first page. **Do NOT "fix" this onto `--slurp`:** `gh help api` documents `--slurp` as
223
+ returning *an array of all pages*, i.e. it NESTS the wire shape into an array OF pages, so the
224
+ selector would find zero comments and every push would post a fresh spam comment.
225
+
226
+ ### Sticky-selector residual (accepted, documented — D-CI7-22)
227
+
228
+ The selector requires `user.type == "Bot"`, `user.login == "github-actions[bot]"`, the marker on
229
+ the body's exact first line, and the vibe-check heading on the next non-empty line. All four are
230
+ **content**, so this is a **collision filter, not an authenticity check**: `github-actions[bot]`
231
+ is the SHARED identity of every workflow in the repo, and a sibling workflow that echoes
232
+ attacker-controlled text could reproduce these lines. The realistic (accidental-echo) class is
233
+ removed; a deliberate same-bot forgery is not, and no stateless rule can close it. Impact if it
234
+ ever happens is bounded to **defacement + suppression of the report — never a verdict change**
235
+ (`post-comment` always exits 0). **Hardening option:** run the action under a **dedicated GitHub
236
+ App or PAT-backed bot identity**, at which point `user.login` becomes a genuine authenticity
237
+ signal — trade-off: a secret to manage, and it is unavailable on fork PRs (which have no token).
238
+
239
+ ### Governance-file symlink residual (S6 — keep them REAL files)
240
+
241
+ S6 warns and forces a full run when the diff touches `.flowharness/suite.lock.json` or
242
+ `.flowharness/gate-policy.toml`. If either governance file is committed as a **symlink**, `git
243
+ diff` reports the link *target* path — which the derived S6 matcher does not watch — so a PR
244
+ could weaken the suite or the gate threshold with **no warning line and no forced run**. Keep
245
+ **both** `.flowharness/suite.lock.json` **and** `.flowharness/gate-policy.toml` as real files
246
+ under `.flowharness/`; if a shared layout is required, point `--suite` / `--gate-policy` at the
247
+ real location so the matcher watches it directly. (Cassette evidence is unaffected — the case-ref
248
+ reader fails closed on any symlinked component.)
249
+
250
+ ## Boundaries
251
+
252
+ Zero network on the default path (no `httpx`); `git` and `gh` are the only local processes
253
+ shelled, each behind an injected runner so the core is offline-testable — and Python never reads
254
+ a token (`gh` authenticates from its own env). The runner reuses `core`, `evaluation.domain`
255
+ (the `GatePolicy` VO), and `inspection` (surface classifier + exit-code table) only — statelessly,
256
+ with no UnitOfWork or web/ORM stack (enforced by the import-linter fences in the root pyproject).
257
+
258
+ ## SDK boundary (ci-spec §5.1 / G10) — the CI runner is NOT the SDK
259
+
260
+ The CI runner (`flowharness-ci`, this package) and the FlowHarness **Python SDK**
261
+ (`flowharness`, under `sdks/python/`) are deliberately separate products, and **the CI runner is
262
+ not the SDK**:
263
+
264
+ - **Different wire.** The runner speaks a **JSON governance-run ingestion** wire — one
265
+ HMAC-signed `POST /v1/evaluation/runs` (`--upload`, above), and otherwise runs fully offline.
266
+ The SDK speaks the **ConnectRPC machine wire** to the management API (typed RPCs, binary
267
+ framing) — the Phase-1 client under `sdks/python/`.
268
+ - **Different audience.** The runner is a **governance gate for CI pipelines**, invoked as a CLI
269
+ (`uvx --from flowharness-ci-runner flowharness-ci vibe-check`). The SDK is for **application
270
+ code** that embeds audit calls programmatically.
271
+
272
+ Programmatic embedding of the runner is out of scope: it exposes a CLI, not a stable client API.
273
+ If you want to call the platform from code, use the SDK (`sdks/python/README.md`); if you want to
274
+ gate a PR, use this runner.