@metasession.co/devaudit-cli 0.1.52 → 0.1.54

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.
@@ -25,14 +25,29 @@ on:
25
25
  branches: [develop]
26
26
  paths:
27
27
  - 'compliance/**'
28
+ # devaudit-installer#149 — listen for completion of the E2E Regression
29
+ # workflow so the critical-tier run on the release PR + the full
30
+ # regression on post-merge to main both upload their JSON results +
31
+ # HTML report to the portal under the right release. Without this hook
32
+ # the UAT four-eyes reviewer only sees smoke-tier evidence from the
33
+ # feature PR's develop merge — the broader sweep against the
34
+ # about-to-be-promoted integration code never reaches the portal.
35
+ workflow_run:
36
+ workflows: ['E2E Regression']
37
+ types: [completed]
28
38
 
29
39
  concurrency:
30
- group: ${{ github.workflow }}-${{ github.ref }}
40
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.workflow_run.id || '' }}
31
41
  cancel-in-progress: true
32
42
 
33
43
  jobs:
34
44
  upload-compliance-evidence:
35
45
  name: Upload Compliance Evidence
46
+ # devaudit-installer#149 — only the push/dispatch paths run the
47
+ # compliance-doc upload. The workflow_run path is handled by the
48
+ # sibling job below; running both on a workflow_run event would
49
+ # double-upload every compliance doc.
50
+ if: github.event_name != 'workflow_run'
36
51
  runs-on: {{RUNNER}}
37
52
  # Permissions are needed because the "Auto-generate housekeeping stubs"
38
53
  # step pushes a new branch + opens a PR via `gh pr create` when the
@@ -412,22 +427,58 @@ jobs:
412
427
  REQ_META_ARGS=$(req_meta_args "$REQ_ID")
413
428
  for ARTIFACT in "$REQ_DIR"*.md; do
414
429
  [ -f "$ARTIFACT" ] || continue
415
- # Per-REQ test-execution-summary.md is the ISO 29119-3 §3.5.6
416
- # Test Completion Report for THIS release cycle (populated by
417
- # the e2e-test-engineer skill in Stage 3 — scope, results, AC
418
- # mapping, defects). Upload as `test_report` so it satisfies
419
- # the portal's Test Reports gate with per-release evidence
420
- # instead of the project-level evergreen TSR (which from
421
- # v0.1.32 downgrades to `compliance_document`). See
422
- # DevAudit-Installer#101.
430
+ # Per-REQ basename (evidence_type, evidence_category) routing.
431
+ # The bare default (compliance_document, planning) is the
432
+ # historical catch-all; the named cases route specific
433
+ # artefacts to their dedicated evidence types so the portal's
434
+ # framework-coverage matrix attributes them correctly:
435
+ #
436
+ # - test-execution-summary.md / test-summary-report.md
437
+ # test_report : ISO 29119-3 §3.5.6 Test Completion
438
+ # Report per release cycle. Satisfies the portal's
439
+ # Test Reports gate with per-release evidence
440
+ # instead of the project-level evergreen TSR (which
441
+ # from v0.1.32 downgrades to compliance_document).
442
+ # DevAudit-Installer#101.
443
+ #
444
+ # - srs-alignment.md
445
+ # → srs_alignment : output of the requirements-aligner
446
+ # skill at Stage 3. Orphan-by-design at v1 per
447
+ # META-COMPLY framework-registry-auditor review;
448
+ # surfaces in Documents tab + audit-pack export.
449
+ # DevAudit-Installer#119.
450
+ #
451
+ # - architecture-decision.md
452
+ # → architecture_decision : output of the adr-author
453
+ # skill at Stage 3. Closes ISO 27001 A.8.25 (Secure
454
+ # development life cycle) via the dedicated type
455
+ # predicate. DevAudit-Installer#120.
456
+ #
457
+ # - risk-assessment.md
458
+ # → risk_assessment : output of the risk-register-keeper
459
+ # skill at Stage 3. Closes SOC 2 CC3.2 (Risk
460
+ # identification and assessment) via the dedicated
461
+ # type predicate. DevAudit-Installer#121.
462
+ #
463
+ # Until this routing existed the new artefacts uploaded as
464
+ # compliance_document, which matches the project-baseline
465
+ # docs predicate but NOT the per-REQ Tier 3 clause
466
+ # predicates that expect the dedicated types — so the matrix
467
+ # reported MISSING / PARTIAL for SOC2.CC3.2 + ISO27001.A.8.25
468
+ # despite the files being present. DevAudit-Installer#146.
423
469
  BASENAME=$(basename "$ARTIFACT")
424
- if [ "$BASENAME" = "test-execution-summary.md" ] || [ "$BASENAME" = "test-summary-report.md" ]; then
425
- EVTYPE=test_report
426
- EVCAT=test_report
427
- else
428
- EVTYPE=compliance_document
429
- EVCAT=planning
430
- fi
470
+ case "$BASENAME" in
471
+ test-execution-summary.md|test-summary-report.md)
472
+ EVTYPE=test_report; EVCAT=test_report ;;
473
+ srs-alignment.md)
474
+ EVTYPE=srs_alignment; EVCAT=planning ;;
475
+ architecture-decision.md)
476
+ EVTYPE=architecture_decision; EVCAT=planning ;;
477
+ risk-assessment.md)
478
+ EVTYPE=risk_assessment; EVCAT=planning ;;
479
+ *)
480
+ EVTYPE=compliance_document; EVCAT=planning ;;
481
+ esac
431
482
  echo "Uploading: ${REQ_ID}/${BASENAME} (${EVTYPE})"
432
483
  eval "bash scripts/upload-evidence.sh \
433
484
  {{PROJECT_SLUG}} \"${REQ_ID}\" ${EVTYPE} \"$ARTIFACT\" \
@@ -440,3 +491,174 @@ jobs:
440
491
 
441
492
  - name: Summary
442
493
  run: echo "Compliance evidence uploaded for ${{ steps.version.outputs.version }}"
494
+
495
+ # devaudit-installer#149 — upload the E2E Regression artefacts to the
496
+ # portal so the critical-tier run on the release PR + the full
497
+ # regression on post-merge to main both land as portal evidence (not
498
+ # just GitHub Actions artifacts).
499
+ #
500
+ # Fires only on `workflow_run` events. The triggering workflow is the
501
+ # consumer's `E2E Regression` (project-owned per the v0.1.53 3-tier
502
+ # gating model) which writes:
503
+ # - e2e-regression-results.json (Playwright JSON reporter)
504
+ # - playwright-report/ (HTML report)
505
+ # - test-results/ (per-spec traces / videos / screenshots)
506
+ # to GitHub Actions artifact storage under the name `e2e-regression-report`.
507
+ # We download that artifact via the workflow_run.id, derive the release
508
+ # version against the triggering run's head_sha, then upload the
509
+ # canonical artefacts as `evidence_type=e2e_result` + `test_report`
510
+ # against each in-scope REQ.
511
+ upload-e2e-regression-evidence:
512
+ name: Upload E2E Regression Evidence
513
+ if: github.event_name == 'workflow_run'
514
+ runs-on: {{RUNNER}}
515
+ # actions: read is required so `actions/download-artifact@v4` with
516
+ # `run-id` can read another workflow's artifacts. Without it the
517
+ # download step fails with a 404 even when the artifact exists.
518
+ permissions:
519
+ contents: read
520
+ actions: read
521
+ env:
522
+ DEVAUDIT_BASE_URL_VAR: ${{ vars.DEVAUDIT_BASE_URL }}
523
+ DEVAUDIT_API_KEY: ${{ secrets.DEVAUDIT_API_KEY }}
524
+ steps:
525
+ - uses: actions/checkout@v4
526
+ with:
527
+ # Check out the SHA the E2E Regression ran against — that
528
+ # determines the release version + the in-scope REQs via the
529
+ # pending release tickets at that snapshot, not whatever
530
+ # default branch currently points to.
531
+ ref: ${{ github.event.workflow_run.head_sha }}
532
+ fetch-depth: 0
533
+
534
+ - name: Resolve DevAudit base URL
535
+ id: resolve
536
+ run: |
537
+ CONFIG_URL=""
538
+ if [ -f sdlc-config.json ]; then
539
+ CONFIG_URL=$(jq -r '.devaudit.base_url // empty' sdlc-config.json 2>/dev/null || true)
540
+ fi
541
+ if [ -n "$CONFIG_URL" ]; then
542
+ BASE="$CONFIG_URL"
543
+ elif [ -n "$DEVAUDIT_BASE_URL_VAR" ]; then
544
+ BASE="$DEVAUDIT_BASE_URL_VAR"
545
+ else
546
+ echo "::warning::No DevAudit base URL configured — skipping E2E evidence upload."
547
+ echo "skip=true" >> "$GITHUB_OUTPUT"
548
+ exit 0
549
+ fi
550
+ if [ -z "${DEVAUDIT_API_KEY}" ]; then
551
+ echo "::warning::DEVAUDIT_API_KEY not set — skipping E2E evidence upload."
552
+ echo "skip=true" >> "$GITHUB_OUTPUT"
553
+ exit 0
554
+ fi
555
+ echo "skip=false" >> "$GITHUB_OUTPUT"
556
+ echo "DEVAUDIT_BASE_URL=${BASE%/}" >> "$GITHUB_ENV"
557
+
558
+ - name: Download E2E Regression artifact
559
+ if: steps.resolve.outputs.skip != 'true'
560
+ uses: actions/download-artifact@v4
561
+ with:
562
+ name: e2e-regression-report
563
+ path: e2e-artifacts/
564
+ run-id: ${{ github.event.workflow_run.id }}
565
+ github-token: ${{ secrets.GITHUB_TOKEN }}
566
+ continue-on-error: true
567
+
568
+ - name: Derive release version
569
+ if: steps.resolve.outputs.skip != 'true'
570
+ id: version
571
+ run: |
572
+ chmod +x scripts/derive-release-version.sh 2>/dev/null || true
573
+ VERSION=$(./scripts/derive-release-version.sh)
574
+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
575
+ echo "Resolved release version: ${VERSION}"
576
+
577
+ - name: Upload E2E Regression evidence to DevAudit
578
+ if: steps.resolve.outputs.skip != 'true'
579
+ run: |
580
+ set -euo pipefail
581
+ DERIVED_RELEASE="${{ steps.version.outputs.version }}"
582
+
583
+ # Tier metadata for the portal (the operator filters/groups by
584
+ # this on the release detail). pull_request → critical;
585
+ # push to main → regression; otherwise dispatch/schedule.
586
+ PRIOR_EVENT="${{ github.event.workflow_run.event }}"
587
+ PRIOR_BRANCH="${{ github.event.workflow_run.head_branch }}"
588
+ case "$PRIOR_EVENT" in
589
+ pull_request) TIER=critical ;;
590
+ push) TIER=regression ;;
591
+ *) TIER="${PRIOR_EVENT}" ;;
592
+ esac
593
+
594
+ # Common flags for upload-evidence.sh. Branch + SHA come from
595
+ # the triggering run, not from this workflow_run dispatch.
596
+ FLAGS="--create-release-if-missing --environment uat \
597
+ --git-sha ${{ github.event.workflow_run.head_sha }} \
598
+ --ci-run-id ${{ github.event.workflow_run.id }} \
599
+ --branch ${PRIOR_BRANCH}"
600
+
601
+ # In-scope REQs from pending release tickets at the triggering
602
+ # SHA. Fall back to `_compliance-docs` if no tickets present so
603
+ # the artefact at least lands somewhere visible.
604
+ REQS=()
605
+ if [ -d compliance/pending-releases ]; then
606
+ for TICKET in compliance/pending-releases/RELEASE-TICKET-REQ-*.md; do
607
+ [ -f "$TICKET" ] || continue
608
+ REQS+=("$(basename "$TICKET" .md | sed 's/^RELEASE-TICKET-//')")
609
+ done
610
+ fi
611
+ if [ "${#REQS[@]}" -eq 0 ]; then
612
+ REQS=(_compliance-docs)
613
+ fi
614
+ echo "Uploading E2E ${TIER}-tier evidence to: ${REQS[*]} (release: ${DERIVED_RELEASE})"
615
+
616
+ UPLOAD_FAILURES=0
617
+ for REQ in "${REQS[@]}"; do
618
+ # 1. JSON reporter output → e2e_result. The single canonical
619
+ # machine-readable artefact for the run.
620
+ if [ -f e2e-artifacts/e2e-regression-results.json ]; then
621
+ if bash scripts/upload-evidence.sh \
622
+ {{PROJECT_SLUG}} "$REQ" e2e_result \
623
+ e2e-artifacts/e2e-regression-results.json \
624
+ --category test_report ${FLAGS} --release "${DERIVED_RELEASE}" \
625
+ --meta-key "tier=${TIER}"
626
+ then
627
+ :
628
+ else
629
+ echo "::warning::e2e_result upload failed for ${REQ}"
630
+ UPLOAD_FAILURES=$((UPLOAD_FAILURES + 1))
631
+ fi
632
+ fi
633
+ # 2. Playwright HTML report index → test_report. Operator-
634
+ # facing artefact (the formatted run summary). Skipped if
635
+ # the report directory is missing (e.g. an upstream
636
+ # infrastructure failure aborted before reporting).
637
+ if [ -f e2e-artifacts/playwright-report/index.html ]; then
638
+ if bash scripts/upload-evidence.sh \
639
+ {{PROJECT_SLUG}} "$REQ" test_report \
640
+ e2e-artifacts/playwright-report/index.html \
641
+ --category test_report ${FLAGS} --release "${DERIVED_RELEASE}" \
642
+ --meta-key "tier=${TIER}"
643
+ then
644
+ :
645
+ else
646
+ echo "::warning::playwright HTML report upload failed for ${REQ}"
647
+ UPLOAD_FAILURES=$((UPLOAD_FAILURES + 1))
648
+ fi
649
+ fi
650
+ done
651
+
652
+ # Per-spec failure screenshots from test-results/ are NOT
653
+ # uploaded: Playwright names them `test-failed-1.png` /
654
+ # `test-finished-1.png`, which the portal's filename
655
+ # validator (REQ-XXX-AC<n>-<slug>.png) rejects. Use the
656
+ # evidenceShot(page, REQ, AC, slug) helper from the
657
+ # e2e-test-engineer skill for per-AC named captures; those
658
+ # upload via ci.yml's per-REQ screenshot loop.
659
+
660
+ if [ "$UPLOAD_FAILURES" -gt 0 ]; then
661
+ echo "::error::${UPLOAD_FAILURES} E2E evidence upload(s) failed — portal release matrix may be incomplete"
662
+ exit 1
663
+ fi
664
+ echo "E2E ${TIER}-tier evidence uploaded for ${#REQS[@]} requirement(s)"