qfai 1.9.2 → 1.10.1
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.
- package/README.md +67 -6
- package/assets/init/.qfai/assistant/README.md +27 -0
- package/assets/init/.qfai/assistant/agents/acceptance-test-engineer.md +1 -0
- package/assets/init/.qfai/assistant/agents/backend-engineer.md +1 -0
- package/assets/init/.qfai/assistant/agents/completion-reviewer.md +29 -2
- package/assets/init/.qfai/assistant/agents/delivery-planner.md +17 -0
- package/assets/init/.qfai/assistant/agents/frontend-engineer.md +1 -0
- package/assets/init/.qfai/assistant/agents/implementation-reviewer.md +17 -0
- package/assets/init/.qfai/assistant/agents/orchestrator.md +2 -2
- package/assets/init/.qfai/assistant/agents/qa-gatekeeper.md +183 -5
- package/assets/init/.qfai/assistant/agents/test-design-analyst.md +22 -3
- package/assets/init/.qfai/assistant/catalog/cli-ux-guidelines.md +2 -2
- package/assets/init/.qfai/assistant/catalog/spec_required_files.json +2 -1
- package/assets/init/.qfai/assistant/catalog/test-layers-ci-lanes.md +60 -0
- package/assets/init/.qfai/assistant/catalog/test-layers.md +430 -13
- package/assets/init/.qfai/assistant/catalog/worklog-entry.schema.md +165 -0
- package/assets/init/.qfai/assistant/constitution/communication.md +1 -1
- package/assets/init/.qfai/assistant/constitution/constitution.md +1 -1
- package/assets/init/.qfai/assistant/constitution/drift-protocol.md +359 -10
- package/assets/init/.qfai/assistant/constitution/quality.md +35 -5
- package/assets/init/.qfai/assistant/constitution/requirements-decomposition.md +37 -0
- package/assets/init/.qfai/assistant/constitution/shared-skill-delegation-baseline.md +419 -8
- package/assets/init/.qfai/assistant/constitution/shared-skill-operating-baseline.md +122 -5
- package/assets/init/.qfai/assistant/constitution/workflow.md +53 -7
- package/assets/init/.qfai/assistant/manifest/agent-catalog.yml +439 -946
- package/assets/init/.qfai/assistant/manifest/agent-routing.yml +116 -4
- package/assets/init/.qfai/assistant/manifest/review-profiles.yml +9 -0
- package/assets/init/.qfai/assistant/process/migrations/v1.4.27-atdd-alignment.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-atdd/SKILL.md +150 -53
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/credential-reuse.md +146 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/red-provenance.md +456 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/review-fix-rounds.md +128 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/scaffolding.md +29 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/shared-test-artifacts.md +96 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/stale-manifest.md +34 -0
- package/assets/init/.qfai/assistant/skills/qfai-atdd/references/test-case-depth-checklist.md +52 -5
- package/assets/init/.qfai/assistant/skills/qfai-configure/SKILL.md +16 -8
- package/assets/init/.qfai/assistant/skills/qfai-discussion/SKILL.md +8 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/design-md-brand-catalog.md +2 -2
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/discussion-completion-matrix.md +17 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/rcp_footer.md +10 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/review-cycle-playbook.md +5 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui-bearing-playbook.md +4 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/review_audit_playbook.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux/trend_scan_playbook.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/references/ui_ux_best_practices.md +17 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/01_Context.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/02_Inception-Deck.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/03_Story-Workshop.md +11 -3
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/05_Scope.md +5 -2
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/07_NFR.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/09_Constraints.md +7 -4
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/10_Policy.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/11_OQ-Register.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/12_OQ-Resolution-Log.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/14_Review-Request.md +14 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/99_delta.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/Rxx_reviewer.md +16 -7
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/review_request.md +9 -6
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/review/summary.json +2 -0
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/40_screen_contracts.md +3 -2
- package/assets/init/.qfai/assistant/skills/qfai-discussion/templates/uiux/50_review_input_bundle.md +4 -2
- package/assets/init/.qfai/assistant/skills/qfai-implement/SKILL.md +252 -130
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/change-request-reset.md +93 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/checkpoint-verification.md +210 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/cross-spec-ownership.md +73 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/evidence-revision.md +291 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/execution-ledger.md +389 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/final-checklist.md +28 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/finding-classification.md +49 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/ledger-preconditions.md +55 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/oracle-strength.md +81 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/parallelization-policy.md +235 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-admissibility.md +91 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/red-not-observable.md +112 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/relevant-test-suite.md +87 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/review-artifact-layout.md +44 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/round-evidence.md +118 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/selector-granularity.md +24 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/upstream-artifact-ordering.md +33 -0
- package/assets/init/.qfai/assistant/skills/qfai-implement/references/volume-policy.md +149 -0
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/SKILL.md +35 -18
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/evidence-requirements.md +1 -1
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/generator-prompt.md +106 -7
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/handoff.md +40 -11
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/references/iteration-loop.md +48 -1
- package/assets/init/.qfai/assistant/skills/qfai-prototyping/templates/DESIGN.md.sample +6 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/SKILL.md +87 -22
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/contract-artifact-rules.md +148 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/rcp_footer.md +10 -4
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/review-cycle-playbook.md +5 -1
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-execution-playbook.md +4 -2
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-phase-checklists.md +18 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-quality-gate.md +44 -3
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/sdd-triage.md +60 -7
- package/assets/init/.qfai/assistant/skills/qfai-sdd/references/spec-traceability-rules.md +171 -6
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/change-request.md +125 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/contracts/db-contract.sample.sql +6 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/evidence/sdd-spec.md +92 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/01_Objective.md +27 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/02_Initiative.md +30 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/05_Contracts.md +16 -6
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/06_Glossary.md +19 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/07_Constraints.md +25 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/08_Decisions.md +22 -2
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/_policies/11_Slice-Policy.md +37 -10
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/02_User-stories.md +20 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/03_Acceptance-Criteria.md +19 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/04_Business-Rules.md +32 -3
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/06_Test-Cases.md +56 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/07_Decisions.md +29 -2
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/10_Plan.md +41 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/16_Traceability-ledger.md +58 -0
- package/assets/init/.qfai/assistant/skills/qfai-sdd/templates/specs/spec/tdd/test-list.md +56 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/SKILL.md +57 -102
- package/assets/init/.qfai/assistant/skills/qfai-verify/references/articles.md +24 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/references/context-load.md +22 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/references/verify-output-contract.md +48 -0
- package/assets/init/.qfai/assistant/skills/qfai-verify/templates/verify-evidence.md +48 -0
- package/assets/init/.qfai/assistant/skills/web-research/SKILL.md +25 -7
- package/assets/init/.qfai/waivers.yml +11 -5
- package/assets/init/root/.github/workflows/qfai-tests.yml +318 -0
- package/assets/init/root/.github/workflows/qfai-validate.yml +327 -24
- package/assets/init/root/DESIGN.md +6 -0
- package/assets/init/root/qfai.config.yaml +15 -12
- package/dist/cli/index.cjs +20646 -13620
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.mjs +22101 -15061
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +13954 -8829
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +423 -14
- package/dist/index.d.ts +423 -14
- package/dist/index.mjs +9330 -4224
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -19
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# QFAI layered test orchestrator
|
|
2
|
+
#
|
|
3
|
+
# Generated by `qfai init`. Declares one lane per test layer (unit,
|
|
4
|
+
# component, integration, api, e2e) as jobs inside this single file.
|
|
5
|
+
#
|
|
6
|
+
# A change-detection job computes which lanes a change would need from a
|
|
7
|
+
# name-only diff against the base commit, and a script probe reads which
|
|
8
|
+
# layer-named test scripts (test:unit, test:component, test:integration,
|
|
9
|
+
# test:api, test:e2e) your package.json declares. A lane runs only when
|
|
10
|
+
# BOTH hold: your package.json declares the matching layer-named test
|
|
11
|
+
# script (your opt-in) and the diff selected the lane. Delete the file if
|
|
12
|
+
# you do not want it; `qfai init` will not recreate a file you
|
|
13
|
+
# deliberately removed.
|
|
14
|
+
#
|
|
15
|
+
# What this file needs from your repository, and how it behaves when it does
|
|
16
|
+
# not get it:
|
|
17
|
+
#
|
|
18
|
+
# | Field | Value |
|
|
19
|
+
# | ----------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
# | Covered layer | all five adopter test layers - unit, component, integration, api, e2e - one lane each |
|
|
21
|
+
# | Runner selector | `vars.QFAI_CI_RUNNER`, default `ubuntu-latest` |
|
|
22
|
+
# | Wrong runner value | GitHub does not fail fast: an unknown label leaves the job queued indefinitely, never red |
|
|
23
|
+
# | `packageManager` precondition | none today - no lane installs. A lane that gains a pnpm install needs `"packageManager"` in package.json |
|
|
24
|
+
# | Inert when | your package.json declares no `test:<layer>` script, or the diff did not select the lane |
|
|
25
|
+
# | Fail-open behaviour | degraded detection (unreachable base, shallow clone, failed diff, unknown path): warning, then every lane |
|
|
26
|
+
#
|
|
27
|
+
# Every lane is declared but inert until you opt in, so this file executes no
|
|
28
|
+
# test in your repository today. It is also self-contained: it does not
|
|
29
|
+
# reference any other workflow file QFAI ships.
|
|
30
|
+
|
|
31
|
+
name: qfai tests
|
|
32
|
+
|
|
33
|
+
on:
|
|
34
|
+
push:
|
|
35
|
+
branches: [main, master]
|
|
36
|
+
pull_request:
|
|
37
|
+
|
|
38
|
+
# One live run per ref: a superseded push or PR update cancels the older run.
|
|
39
|
+
concurrency:
|
|
40
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
41
|
+
cancel-in-progress: true
|
|
42
|
+
|
|
43
|
+
jobs:
|
|
44
|
+
detection:
|
|
45
|
+
name: change detection
|
|
46
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
47
|
+
# Reads the repository only; the name-only diff writes nothing back.
|
|
48
|
+
permissions:
|
|
49
|
+
contents: read
|
|
50
|
+
timeout-minutes: 5
|
|
51
|
+
outputs:
|
|
52
|
+
lanes: ${{ steps.diff.outputs.lanes }}
|
|
53
|
+
scripts: ${{ steps.scripts.outputs.scripts }}
|
|
54
|
+
steps:
|
|
55
|
+
- name: Checkout with full history via actions/checkout 4.4.0
|
|
56
|
+
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
|
57
|
+
with:
|
|
58
|
+
persist-credentials: false
|
|
59
|
+
# Full history is requested by this job only: the name-only
|
|
60
|
+
# diff needs the base commit reachable locally.
|
|
61
|
+
fetch-depth: 0
|
|
62
|
+
- name: Select lanes from the name-only diff
|
|
63
|
+
id: diff
|
|
64
|
+
env:
|
|
65
|
+
# Pull requests diff against the PR base; pushes against the
|
|
66
|
+
# previous head.
|
|
67
|
+
QFAI_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }}
|
|
68
|
+
# Which diff form to take, because the two events want different ones. On a pull
|
|
69
|
+
# request the question is what THIS branch changed, which is the merge base (`A...B`).
|
|
70
|
+
# On a push the question is what the push changed, which is the previous head against
|
|
71
|
+
# the new one (`A B`) — `A...B` there is `git diff $(git merge-base A B) B`, so a
|
|
72
|
+
# non-fast-forward push drops everything the old head carried and the new one does not.
|
|
73
|
+
# A force-push whose new side touches only documentation would otherwise report no
|
|
74
|
+
# lanes, skip every test and accept a default branch that lost a source file.
|
|
75
|
+
QFAI_EVENT_NAME: ${{ github.event_name }}
|
|
76
|
+
shell: bash
|
|
77
|
+
run: |
|
|
78
|
+
# Selects the test-lane matrix from a name-only diff against the
|
|
79
|
+
# base commit. Docs-only changes need no test lane (the minimal,
|
|
80
|
+
# empty set); anything touching source selects the full set. Any
|
|
81
|
+
# degraded input - missing or unreachable base, shallow clone, a
|
|
82
|
+
# failed diff, or a changed path outside the recognized set -
|
|
83
|
+
# FAILS OPEN: warn and select the full lane superset, so a
|
|
84
|
+
# degraded run never claims a result it did not establish.
|
|
85
|
+
FULL_LANES='["unit","component","integration","api","e2e"]'
|
|
86
|
+
emit() { echo "lanes=$1" >> "$GITHUB_OUTPUT"; }
|
|
87
|
+
fail_open() {
|
|
88
|
+
echo "::warning::qfai tests change detection: $1 - selecting the full lane superset (fail open)"
|
|
89
|
+
emit "$FULL_LANES"
|
|
90
|
+
exit 0
|
|
91
|
+
}
|
|
92
|
+
if [ -z "${QFAI_BASE_REF:-}" ]; then
|
|
93
|
+
fail_open "no base reference available"
|
|
94
|
+
fi
|
|
95
|
+
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
|
|
96
|
+
fail_open "shallow clone: the base commit may be unreachable"
|
|
97
|
+
fi
|
|
98
|
+
if ! git rev-parse --verify --quiet "${QFAI_BASE_REF}^{commit}" > /dev/null; then
|
|
99
|
+
fail_open "base reference is not reachable"
|
|
100
|
+
fi
|
|
101
|
+
# --no-renames is load-bearing. With rename detection on, git
|
|
102
|
+
# reports only the DESTINATION of a move, so moving
|
|
103
|
+
# src/foo.ts to docs/foo.md arrives here as one documentation
|
|
104
|
+
# path and the source half of the change selects no lane.
|
|
105
|
+
# Turning detection off makes both halves visible.
|
|
106
|
+
# Two calls rather than one with a computed range: a bash array reads as an unparsable
|
|
107
|
+
# program to the shipped-lane guard, which enumerates every command a shipped workflow
|
|
108
|
+
# may invoke. Written out, both branches are the same enumerated git diff.
|
|
109
|
+
if [ "${QFAI_EVENT_NAME:-}" = "pull_request" ]; then
|
|
110
|
+
if ! changed="$(git diff --name-only --no-renames "${QFAI_BASE_REF}...HEAD")"; then
|
|
111
|
+
fail_open "name-only diff failed"
|
|
112
|
+
fi
|
|
113
|
+
else
|
|
114
|
+
if ! changed="$(git diff --name-only --no-renames "${QFAI_BASE_REF}" HEAD)"; then
|
|
115
|
+
fail_open "name-only diff failed"
|
|
116
|
+
fi
|
|
117
|
+
fi
|
|
118
|
+
docs_only=true
|
|
119
|
+
while IFS= read -r changed_path; do
|
|
120
|
+
[ -z "$changed_path" ] && continue
|
|
121
|
+
case "$changed_path" in
|
|
122
|
+
# Source and test DIRECTORIES are matched first, before any
|
|
123
|
+
# extension rule. A file's directory decides what it is: a
|
|
124
|
+
# template read at runtime (src/templates/prompt.md) or a
|
|
125
|
+
# fixture read by a test (tests/fixtures/input.txt) is part
|
|
126
|
+
# of the code, and an extension rule evaluated first would
|
|
127
|
+
# call both of them documentation and skip every lane.
|
|
128
|
+
#
|
|
129
|
+
# At ANY depth, which the leading-segment forms alone are not.
|
|
130
|
+
# A `case` glob's `*` matches `/` too, so in a monorepo
|
|
131
|
+
# `packages/app/src/template.md` did not match `src/*` and fell
|
|
132
|
+
# through to the documentation branch below: `lanes=[]`, every
|
|
133
|
+
# declared test script skipped, verdict green. The nested forms
|
|
134
|
+
# are what make the directory rule a directory rule rather than a
|
|
135
|
+
# repository-root rule.
|
|
136
|
+
src/*|tests/*|.github/*|*/src/*|*/tests/*) docs_only=false ;;
|
|
137
|
+
# Documentation is a LOCATION, not an extension.
|
|
138
|
+
#
|
|
139
|
+
# Naming source directories and letting every other `.md` / `.txt`
|
|
140
|
+
# be documentation only moves the hole to the next directory name.
|
|
141
|
+
# Measured against this block: with `src` and `tests` named,
|
|
142
|
+
# `packages/app/test/fixture.txt` (singular), `__tests__/`,
|
|
143
|
+
# `spec/`, `fixtures/` and `testdata/` all still took the
|
|
144
|
+
# documentation arm — lanes=[], every declared test:<layer> script
|
|
145
|
+
# skipped, verdict green. An adopter's directory naming is not
|
|
146
|
+
# ours to enumerate.
|
|
147
|
+
#
|
|
148
|
+
# So the documentation arm is the narrow one: an explicit `docs`
|
|
149
|
+
# directory at any depth, or a document at the repository ROOT.
|
|
150
|
+
# A `.md` or `.txt` anywhere else is content some code or test
|
|
151
|
+
# reads, and the safe verdict for "we cannot tell" is to run the
|
|
152
|
+
# lanes.
|
|
153
|
+
docs/*|*/docs/*) ;;
|
|
154
|
+
*.md|*.markdown|*.txt|LICENSE)
|
|
155
|
+
case "$changed_path" in
|
|
156
|
+
*/*) docs_only=false ;;
|
|
157
|
+
*) ;;
|
|
158
|
+
esac
|
|
159
|
+
;;
|
|
160
|
+
*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.json|*.yml|*.yaml|*.lock) docs_only=false ;;
|
|
161
|
+
*) fail_open "changed path outside the recognized set: ${changed_path}" ;;
|
|
162
|
+
esac
|
|
163
|
+
done <<< "$changed"
|
|
164
|
+
if [ "$docs_only" = "true" ]; then
|
|
165
|
+
emit "[]"
|
|
166
|
+
else
|
|
167
|
+
emit "$FULL_LANES"
|
|
168
|
+
fi
|
|
169
|
+
- name: Probe layer-named test scripts
|
|
170
|
+
id: scripts
|
|
171
|
+
shell: bash
|
|
172
|
+
run: |
|
|
173
|
+
# Emits the layers whose opt-in test script (test:unit,
|
|
174
|
+
# test:component, test:integration, test:api, test:e2e) exists
|
|
175
|
+
# in package.json, as a JSON array. Every lane below keys its
|
|
176
|
+
# run condition on membership in this output: no declared
|
|
177
|
+
# script, no executing lane. A missing or unparsable
|
|
178
|
+
# package.json declares nothing, so every lane stays skipped -
|
|
179
|
+
# the safe default for an opt-in, because running a lane
|
|
180
|
+
# without its script could only fail. The probe uses the
|
|
181
|
+
# runner's preinstalled node and installs nothing.
|
|
182
|
+
declared="[]"
|
|
183
|
+
if [ -f package.json ]; then
|
|
184
|
+
declared="$(node -e '
|
|
185
|
+
const { readFileSync } = require("node:fs");
|
|
186
|
+
let scripts = {};
|
|
187
|
+
try {
|
|
188
|
+
const parsed = JSON.parse(readFileSync("package.json", "utf8"));
|
|
189
|
+
if (
|
|
190
|
+
parsed !== null &&
|
|
191
|
+
typeof parsed === "object" &&
|
|
192
|
+
parsed.scripts !== null &&
|
|
193
|
+
typeof parsed.scripts === "object"
|
|
194
|
+
) {
|
|
195
|
+
scripts = parsed.scripts;
|
|
196
|
+
}
|
|
197
|
+
} catch {
|
|
198
|
+
scripts = {};
|
|
199
|
+
}
|
|
200
|
+
const layers = ["unit", "component", "integration", "api", "e2e"];
|
|
201
|
+
const declared = layers.filter(
|
|
202
|
+
(layer) => typeof scripts["test:" + layer] === "string",
|
|
203
|
+
);
|
|
204
|
+
process.stdout.write(JSON.stringify(declared));
|
|
205
|
+
')" || declared="[]"
|
|
206
|
+
fi
|
|
207
|
+
echo "scripts=${declared}" >> "$GITHUB_OUTPUT"
|
|
208
|
+
unit:
|
|
209
|
+
name: unit tests
|
|
210
|
+
needs: detection
|
|
211
|
+
if: ${{ contains(needs.detection.outputs.scripts, 'unit') && contains(needs.detection.outputs.lanes, 'unit') }}
|
|
212
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
213
|
+
# Least privilege for a test lane: read the repository, write nothing
|
|
214
|
+
# back. Bounded even while the lane is skipped.
|
|
215
|
+
permissions:
|
|
216
|
+
contents: read
|
|
217
|
+
timeout-minutes: 10
|
|
218
|
+
steps:
|
|
219
|
+
- name: unit lane placeholder
|
|
220
|
+
# An annotation and not a bare echo: this lane was SELECTED and
|
|
221
|
+
# still ran no test, so a silent green step would read as a
|
|
222
|
+
# passing unit suite. The warning says what was established.
|
|
223
|
+
run: |
|
|
224
|
+
echo "::warning::qfai tests: the unit lane was selected but ran no test - the test-lane body ships in a later revision of this file, so this lane establishes nothing"
|
|
225
|
+
component:
|
|
226
|
+
name: component tests
|
|
227
|
+
needs: detection
|
|
228
|
+
if: ${{ contains(needs.detection.outputs.scripts, 'component') && contains(needs.detection.outputs.lanes, 'component') }}
|
|
229
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
230
|
+
# Least privilege for a test lane: read the repository, write nothing
|
|
231
|
+
# back. Bounded even while the lane is skipped.
|
|
232
|
+
permissions:
|
|
233
|
+
contents: read
|
|
234
|
+
timeout-minutes: 10
|
|
235
|
+
steps:
|
|
236
|
+
- name: component lane placeholder
|
|
237
|
+
# An annotation and not a bare echo: this lane was SELECTED and
|
|
238
|
+
# still ran no test, so a silent green step would read as a
|
|
239
|
+
# passing component suite. The warning says what was established.
|
|
240
|
+
run: |
|
|
241
|
+
echo "::warning::qfai tests: the component lane was selected but ran no test - the test-lane body ships in a later revision of this file, so this lane establishes nothing"
|
|
242
|
+
integration:
|
|
243
|
+
name: integration tests
|
|
244
|
+
needs: detection
|
|
245
|
+
if: ${{ contains(needs.detection.outputs.scripts, 'integration') && contains(needs.detection.outputs.lanes, 'integration') }}
|
|
246
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
247
|
+
# Least privilege for a test lane: read the repository, write nothing
|
|
248
|
+
# back. Bounded even while the lane is skipped.
|
|
249
|
+
permissions:
|
|
250
|
+
contents: read
|
|
251
|
+
timeout-minutes: 10
|
|
252
|
+
steps:
|
|
253
|
+
- name: integration lane placeholder
|
|
254
|
+
# An annotation and not a bare echo: this lane was SELECTED and
|
|
255
|
+
# still ran no test, so a silent green step would read as a
|
|
256
|
+
# passing integration suite. The warning says what was established.
|
|
257
|
+
run: |
|
|
258
|
+
echo "::warning::qfai tests: the integration lane was selected but ran no test - the test-lane body ships in a later revision of this file, so this lane establishes nothing"
|
|
259
|
+
api:
|
|
260
|
+
name: api tests
|
|
261
|
+
needs: detection
|
|
262
|
+
if: ${{ contains(needs.detection.outputs.scripts, 'api') && contains(needs.detection.outputs.lanes, 'api') }}
|
|
263
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
264
|
+
# Least privilege for a test lane: read the repository, write nothing
|
|
265
|
+
# back. Bounded even while the lane is skipped.
|
|
266
|
+
permissions:
|
|
267
|
+
contents: read
|
|
268
|
+
timeout-minutes: 10
|
|
269
|
+
steps:
|
|
270
|
+
- name: api lane placeholder
|
|
271
|
+
# An annotation and not a bare echo: this lane was SELECTED and
|
|
272
|
+
# still ran no test, so a silent green step would read as a
|
|
273
|
+
# passing api suite. The warning says what was established.
|
|
274
|
+
run: |
|
|
275
|
+
echo "::warning::qfai tests: the api lane was selected but ran no test - the test-lane body ships in a later revision of this file, so this lane establishes nothing"
|
|
276
|
+
e2e:
|
|
277
|
+
name: e2e tests
|
|
278
|
+
needs: detection
|
|
279
|
+
if: ${{ contains(needs.detection.outputs.scripts, 'e2e') && contains(needs.detection.outputs.lanes, 'e2e') }}
|
|
280
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
281
|
+
# Least privilege for a test lane: read the repository, write nothing
|
|
282
|
+
# back. Bounded even while the lane is skipped.
|
|
283
|
+
permissions:
|
|
284
|
+
contents: read
|
|
285
|
+
timeout-minutes: 10
|
|
286
|
+
steps:
|
|
287
|
+
- name: e2e lane placeholder
|
|
288
|
+
# An annotation and not a bare echo: this lane was SELECTED and
|
|
289
|
+
# still ran no test, so a silent green step would read as a
|
|
290
|
+
# passing e2e suite. The warning says what was established.
|
|
291
|
+
run: |
|
|
292
|
+
echo "::warning::qfai tests: the e2e lane was selected but ran no test - the test-lane body ships in a later revision of this file, so this lane establishes nothing"
|
|
293
|
+
verdict:
|
|
294
|
+
name: verdict
|
|
295
|
+
needs: [detection, unit, component, integration, api, e2e]
|
|
296
|
+
# Always-run: the verdict reports even when every lane above was
|
|
297
|
+
# skipped (the empty-matrix case). Skipped lanes are green - they
|
|
298
|
+
# established nothing and claim nothing; failed lanes are not.
|
|
299
|
+
if: ${{ always() }}
|
|
300
|
+
runs-on: ${{ vars.QFAI_CI_RUNNER || 'ubuntu-latest' }}
|
|
301
|
+
# The verdict only aggregates results GitHub already computed; it
|
|
302
|
+
# needs no repository access at all.
|
|
303
|
+
permissions: {}
|
|
304
|
+
timeout-minutes: 5
|
|
305
|
+
steps:
|
|
306
|
+
- name: Aggregate lane results (green on skip)
|
|
307
|
+
env:
|
|
308
|
+
QFAI_NEEDS_JSON: ${{ toJSON(needs) }}
|
|
309
|
+
shell: bash
|
|
310
|
+
run: |
|
|
311
|
+
# A failed or cancelled lane turns the verdict red; success and
|
|
312
|
+
# skipped both stay green, so an empty matrix exits 0 without
|
|
313
|
+
# claiming results it does not have.
|
|
314
|
+
if printf '%s' "$QFAI_NEEDS_JSON" | grep -Eq '"result": *"(failure|cancelled)"'; then
|
|
315
|
+
echo "::error::qfai tests: a selected lane failed"
|
|
316
|
+
exit 1
|
|
317
|
+
fi
|
|
318
|
+
echo "qfai tests verdict: green (no selected lane reported a failure; a skipped lane and a placeholder lane both establish nothing)"
|