Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pr-orchestrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ jobs:
echo "✅ Found coverage.xml"
- name: Run quality gates
run: |
set -o pipefail
mkdir -p logs/quality-gates
QG_LOG="logs/quality-gates/quality-gates_$(date -u +%Y%m%d_%H%M%S).log"
{
Expand All @@ -653,7 +654,7 @@ jobs:

config = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
configured_fail_under = float(config["tool"]["coverage"]["report"]["fail_under"])
print(max(configured_fail_under, 80.0))
print(configured_fail_under)
PY
)
COVERAGE_PERCENT=$(python - <<'PY'
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ All notable changes to this project will be documented in this file.

---

## [0.53.1] - 2026-07-17

### Fixed

- Hardened native source readiness and corrected coverage-gate enforcement.

## [0.53.0] - 2026-07-17

### Added

- **Native source readiness**: reject incomplete Spec Kit artifacts and
policy-required invalid OpenSpec changes before requirement evidence is
normalized.

---

## [0.52.3] - 2026-07-14

### Fixed
Expand Down
4 changes: 3 additions & 1 deletion docs/reference/commands.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,9 @@
"options": [
"--bundle",
"--format",
"--from-file"
"--from-file",
"--from-openspec",
"--from-speckit"
],
"owner_package": "nold-ai/specfact-requirements",
"owner_repo": "nold-ai/specfact-cli-modules",
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/commands.generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ This file is generated from the current CLI command tree. Do not edit by hand.
| `specfact project version set` | nold-ai/specfact-project | --bundle, --repo, --version; args: - | - | |
| `specfact requirements` | nold-ai/specfact-requirements | --install-completion, --show-completion; args: - | coverage, import, list, validate | |
| `specfact requirements coverage` | nold-ai/specfact-requirements | --bundle, --format; args: - | - | |
| `specfact requirements import` | nold-ai/specfact-requirements | --bundle, --format, --from-file; args: - | - | |
| `specfact requirements import` | nold-ai/specfact-requirements | --bundle, --format, --from-file, --from-openspec, --from-speckit; args: - | - | |
Comment thread
djm81 marked this conversation as resolved.
| `specfact requirements list` | nold-ai/specfact-requirements | --bundle, --format, --show-coverage; args: - | - | |
| `specfact requirements validate` | nold-ai/specfact-requirements | --bundle, --format, --profile; args: - | - | |
| `specfact spec` | nold-ai/specfact-spec | --install-completion, --show-completion; args: - | backward-compat, generate-tests, mock, validate | |
Expand Down
26 changes: 25 additions & 1 deletion docs/reference/requirements-context-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tracks:
- src/specfact_cli/requirements/importers.py
- tests/unit/requirements/test_context_adapter.py
- tests/unit/requirements/test_upstream_evidence_imports.py
last_reviewed: 2026-07-13
last_reviewed: 2026-07-17
exempt: false
exempt_reason: ""
---
Expand Down Expand Up @@ -64,6 +64,30 @@ version, and network-dependent parsing would make CI non-reproducible. To add
an upstream format, add a pinned representative fixture, extend the core
profile, and pass its compatibility test before release.

## Source Readiness

Before emitting records, native imports reject incomplete Spec Kit sources with
an error diagnostic and no partial records. This includes recognized official
scaffold markers, unresolved `NEEDS CLARIFICATION` text, missing substantive
Functional Requirements, and a user story without a complete
Given/When/Then acceptance scenario. The initial compatibility fixture is
pinned to Spec Kit `v0.12.18`.

OpenSpec imports remain portable by default. Native OpenSpec validation is
required only when the layered policy enables it:

```yaml
validation:
openspec:
require_native_validation: true
```

The enterprise tier enables this policy by default; `strict` and
`enterprise_full_stack` resolve through that tier. When validation is required,
the importer runs `openspec validate <change> --strict --json` with a bounded
timeout. A failed validation yields `source-invalid`; a missing executable
yields `upstream-validator-unavailable`.

## Import Validation Gates

For OpenSpec and Spec Kit records, `validate_requirement_context(...)` emits
Expand Down
2 changes: 1 addition & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ This file is generated from the current CLI command tree. Do not edit by hand.
| `specfact project version set` | nold-ai/specfact-project | --bundle, --repo, --version; args: - | - | |
| `specfact requirements` | nold-ai/specfact-requirements | --install-completion, --show-completion; args: - | coverage, import, list, validate | |
| `specfact requirements coverage` | nold-ai/specfact-requirements | --bundle, --format; args: - | - | |
| `specfact requirements import` | nold-ai/specfact-requirements | --bundle, --format, --from-file; args: - | - | |
| `specfact requirements import` | nold-ai/specfact-requirements | --bundle, --format, --from-file, --from-openspec, --from-speckit; args: - | - | |
| `specfact requirements list` | nold-ai/specfact-requirements | --bundle, --format, --show-coverage; args: - | - | |
| `specfact requirements validate` | nold-ai/specfact-requirements | --bundle, --format, --profile; args: - | - | |
| `specfact spec` | nold-ai/specfact-spec | --install-completion, --show-completion; args: - | backward-compat, generate-tests, mock, validate | |
Expand Down
10 changes: 7 additions & 3 deletions openspec/CHANGE_ORDER.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ active changes should be implemented.

| Bucket | Count | Location |
|---|---:|---|
| **Active** | 18 | [`openspec/changes/`](changes/) |
| **Active** | 19 | [`openspec/changes/`](changes/) |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
| **Parked** | 21 | [`openspec/parking-lot/`](parking-lot/) |
| **Archived** | 115 | [`openspec/changes/archive/`](changes/archive/) |

Expand Down Expand Up @@ -38,7 +38,7 @@ brownfield delivery. The active roadmap should make that thesis stronger:

## Active tracks

The 18 active changes group into three product tracks plus one reliability lane.
The 19 active changes group into three product tracks plus one reliability lane.
Tracks can run in parallel; within a track, follow the order column.

### Track A - Validation Evidence Spine
Expand Down Expand Up @@ -83,7 +83,8 @@ planning workflows.
| 1 | `requirements-01-data-model` | [#238](https://github.com/nold-ai/specfact-cli/issues/238) | Normalized requirements-input records for evidence | arch-07 |
| 2 | `requirements-02-module-commands` | [#239](https://github.com/nold-ai/specfact-cli/issues/239) | Import and normalize existing requirement context | requirements-01 |
| 3 | `openspec-01-intent-trace` | [#350](https://github.com/nold-ai/specfact-cli/issues/350) | Import-first OpenSpec and Spec Kit requirement evidence with pass/fail gates (rescoped 2026-07-13) | requirements-01/02 |
| 4 | `architecture-01-solution-layer` | [#240](https://github.com/nold-ai/specfact-cli/issues/240) | Architecture-boundary records and drift validation | requirements input contracts |
| 4 | `requirements-04-upstream-source-readiness` | [#648](https://github.com/nold-ai/specfact-cli/issues/648) | Reject incomplete or policy-invalid native OpenSpec and Spec Kit sources before requirement normalization | openspec-01; paired modules #346 |
| 5 | `architecture-01-solution-layer` | [#240](https://github.com/nold-ai/specfact-cli/issues/240) | Architecture-boundary records and drift validation | requirements input contracts |
| Parked | `requirements-03-backlog-sync` | [#244](https://github.com/nold-ai/specfact-cli/issues/244) | Read-first drift evidence; no write-back critical path. Deprioritized 2026-07-13 behind openspec-01 | requirements-02; modules `sync-01` |
| Gated | `architecture-02-well-architected-review` | [#524](https://github.com/nold-ai/specfact-cli/issues/524) | Architecture-boundary review findings | architecture-01 shipped plus one usage cycle |
| Gated | `telemetry-01-opentelemetry-default-on` | [#518](https://github.com/nold-ai/specfact-cli/issues/518) | Opt-in validation outcome telemetry only | governance-01 evidence fields |
Expand All @@ -110,6 +111,7 @@ Update each proposal first, then run strict OpenSpec validation.
| `requirements-01-data-model` | Reduce to optional normalized requirements-input records for validation evidence. |
| `requirements-02-module-commands` | Drop requirement authoring as a flagship path. Keep import, normalization, validation, and coverage inspection. |
| `requirements-03-backlog-sync` | Make drift detection/read-first import the product value. Keep write-back preview out of the critical path. |
| `requirements-04-upstream-source-readiness` | Keep source readiness core-owned and atomic; do not create an upstream authoring schema or require the OpenSpec CLI outside explicit or strict/enterprise policy. |
| `architecture-01-solution-layer` | Reduce to architecture-boundary validation and drift evidence. Do not generate architecture. |
| `openspec-01-intent-trace` | Done 2026-07-13: rescoped to import-first adapter consuming native OpenSpec and Spec Kit artifacts with deterministic pass/fail gates. |
| `dogfooding-01-full-chain-e2e-proof` | Rewrite proof around real PR review, JSON evidence, AI-bloat findings, remediation packets, rerun proof. |
Expand Down Expand Up @@ -161,6 +163,8 @@ Update each proposal first, then run strict OpenSpec validation.
- `openspec-01` as import-first OpenSpec and Spec Kit requirement evidence
adapter with deterministic gates; pulled forward to Track C order 3 on
2026-07-13 (rescoped, no longer positioned as optional-only).
- `requirements-04` as the core-owned source-readiness follow-up to
`openspec-01`; it blocks the paired modules command/persistence patch.
- `architecture-02`, `telemetry-01`, and `ai-integration-02` only after pull
from the validation loop exists.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
schema: spec-driven
created: 2026-07-14
goal: Provide a core-owned, deterministic source-readiness contract that
protects evidence integrity without creating an upstream authoring schema or
hard runtime dependency.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Change Validation Report: requirements-04-upstream-source-readiness

**Validation Date**: 2026-07-17 Europe/Berlin
**Change Proposal**: [proposal.md](./proposal.md)
**Validation Method**: Interface dry run in `/private/tmp/specfact-validation-requirements-04`, dependency search, strict OpenSpec validation, focused tests, and repository quality-gate verification.

## Executive Summary

- Breaking Changes: 0 detected
- Dependent Files: 3 affected
- Impact Level: Medium
- Validation Result: Pass
- User Decision: Resolved the readiness policy as `validation.openspec.require_native_validation`; the enterprise tier defaults it to `true`, and the compatibility fixture is pinned to Spec Kit `v0.12.18`.

## Breaking Changes Detected

None. `import_openspec_change` adds optional keyword-only `profile` and
`project_root` parameters, preserving its existing one-argument call contract.

## Dependencies Affected

### Critical Updates Required

- `src/specfact_cli/requirements/importers.py`: add atomic readiness gates before normalization.
- `src/specfact_cli/requirements/context.py`: resolve the layered native-validation policy.

### Recommended Updates

- `tests/unit/requirements/test_upstream_evidence_imports.py`: fixture-backed source-readiness and policy tests.
- `docs/reference/requirements-context-adapter.md`: document diagnostics and layered policy behavior.

## Impact Assessment

- **Code Impact**: Read-only source import behavior becomes fail-closed for incomplete inputs; accepted source IDs, revisions, and scenarios remain unchanged.
- **Test Impact**: Native importer and profile-resolution regression coverage.
- **Quality-Gate Impact**: The workflow uses the configured line-coverage threshold and propagates quality-gate failures through its log pipeline.
- **Documentation Impact**: Requirements adapter reference documents readiness diagnostics and policy configuration.
- **Release Impact**: Minor feature; version/release work remains a delivery task after this PR is accepted.

## Format Validation

- **proposal.md Format**: Pass under repository strict OpenSpec validation.
- **tasks.md Format**: Pass; tests precede production edits and evidence is recorded in `TDD_EVIDENCE.md`.
- **specs Format**: Pass; scenarios cover incomplete sources, required validator failure, unavailable validators, and portable imports.
- **Config.yaml Compliance**: Pass.

## OpenSpec Validation

- **Status**: Pass
- **Command**: `openspec validate requirements-04-upstream-source-readiness --strict --json`
- **Issues Found/Fixed**: 0

## Validation Artifacts

- Temporary interface workspace: `/private/tmp/specfact-validation-requirements-04`
- Failing-before and passing-after commands: [TDD_EVIDENCE.md](./TDD_EVIDENCE.md)
- The sibling internal repository is available, but it has no
`wiki/sources/requirements-04-upstream-source-readiness.md` mirror to update;
create that tracking page before release coordination if it becomes required.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# requirements-04-upstream-source-readiness

Reject incomplete or policy-invalid native OpenSpec and Spec Kit sources before normalizing requirements evidence.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# TDD Evidence: requirements-04-upstream-source-readiness

## Failing-before

- **Date:** 2026-07-17 (Europe/Berlin)
- **Command:** `hatch run test -- tests/unit/requirements/test_upstream_evidence_imports.py`
- **Result:** 6 failed, 22 passed.
- **Expected failures:** the pristine v0.12.18 Spec Kit scaffold emitted six
placeholder records; incomplete Spec Kit sources returned the prior
compatibility result or partial records; and native-validation tests could
not exercise a policy-gated subprocess because that behavior did not exist.
- **Non-blocking environment warnings:** pytest could not write its cache in
the sandboxed feature worktree.

## Passing-after

- **Date:** 2026-07-17 (Europe/Berlin)
- **Command:** `hatch run test -- tests/unit/requirements/test_upstream_evidence_imports.py`
- **Result:** 44 passed.
- **Summary:** The pinned v0.12.18 scaffold, incomplete Functional
Requirements, placeholder Functional Requirements, sources with no user
story, scenarios outside a user story, invalid native validator results,
timeouts, and unavailable validators now fail atomically. Enterprise aliases
and layered policy overrides are covered, while portable imports do not probe
an ambient executable.

## Quality evidence

- `hatch run format`, `hatch run lint`, `hatch run yaml-lint`, and
`hatch run contract-test`: passed. `hatch run lint` includes the repository
basedpyright type-check gate.
- `hatch run smart-test-full`: 2,869 tests passed and 9 skipped; the local
full-suite line coverage is 64%, above the configured 50% threshold. The
PR runner independently measures 68.57% for its coverage artifact.
- `hatch run smart-test`: focused-change execution passed; it is not used as
the full-suite coverage assertion.
- `hatch run semgrep-sast --json --output logs/static-analysis/semgrep.json`,
`hatch run semgrep-sast-gate --results logs/static-analysis/semgrep.json
--baseline tools/semgrep/sast-baseline.json`, and `hatch run bandit-scan -f
json -o logs/static-analysis/bandit.json`: passed with no blocking findings.
- `hatch run python scripts/pre_commit_code_review.py ...`: passed with zero
findings; report written to `.specfact/code-review.json`.
Comment thread
djm81 marked this conversation as resolved.
Loading
Loading