This file categorizes the failures observed during Phase 14 validation runs and maps them to root causes and RFC alignment. This is a frozen triage artifact — no fixes were applied in Phase 14; this document is authoritative for the classification of defects requiring targeted PRs.
- Total passing tests: 224
- Total failing tests: 55
- Date: 2025-12-13
- Reproduction:
pytest -qafter self-host runs; artifacts saved inartifacts/self_hosting_run_1and_run_2.
- Generator lockfile / preflight contract
- Observed error:
ValueError: GENERATOR_LOCKFILE_MISMATCH: expected 1.0.0 but spec requests unknown - Affected tests (examples):
- tests/checklist/test_ast_integration.py::test_ast_integration_basic
- tests/checklist/test_timings.py::test_timings_exist
- tests/test_preflight_contract.py::test_preflight_basic
- tests/cli/test_validate_spec.py::test_validate_spec_valid_spec
- Affected files:
src/shieldcraft/services/generator/contract_verifier.py,generators/lockfile.json. - Root cause summary: Current implementation raises a ValueError when the spec omits
metadata.generator_versionand agenerators/lockfile.jsonis present. Tests and preflight should receive violation objects not thrown exceptions. - RFC alignment:
rfc-generator-version-contract.md - Required behavior (authoritative): Preflight should return a violations list and mark contract_ok=False for mismatch; raising an exception is reserved for CI or CLI enforcement, not unit-level contract checks.
- Implementation notes (non-executable): Adjust
verify_generation_contractto return violations; update preflight to aggregate violations rather than raising. - Status: REMEDIATED (Phase 15) -
verify_generation_contractnow returns violations instead of raising, andrun_preflightaggregates violations.
- DSL version enforcement
- Observed error:
ValueError: DSL version check failed: expected 'canonical_v1_frozen', got 'None'. Spec must use frozen canonical DSL. - Affected tests (examples): tests/test_engine.py::test_engine_pipeline, tests/engine/test_engine_end_to_end.py::test_engine_end_to_end_basic
- Affected files:
src/shieldcraft/engine.py,src/shieldcraft/dsl/loader.py - Root cause summary: Engine enforces
dsl_versionstrictly; many tests generate specs withmetadata.spec_formatinstead and expect loader mapping to canonical DSL (spec_format=>dsl_version). - RFC alignment:
rfc-pointer-map-semantics.mdand the Phase 13 schema changes that mapmetadata.spec_formatto canonical DSL v1. - Required behavior: Engine must accept
metadata.spec_formatand map without raising, or tests must include explicitdsl_versionfor canonical specs. - Implementation notes: Add mapping in engine
runchecks to acceptmetadata.spec_formatvalues or move mapping into loader and ensure engine uses loader result to decide validation. - Status: REMEDIATED (Phase 15) -
Engine.runno longer performs a pre-check;load_spechandles canonical mapping formetadata.spec_formatand supports legacy specs.
- EvidenceBundle backward compatibility
- Observed error:
TypeError: EvidenceBundle.build() missing 2 required keyword-only arguments: 'invariants' and 'graph' - Affected tests: tests/test_governance_evidence.py::test_evidence, engine path when generating evidence
- Affected files:
src/shieldcraft/services/governance/evidence.py,src/shieldcraft/engine.py(call sites) - Root cause summary: New EvidenceBundle signature requires (checklist, invariants, graph, provenance); some calls in tests and code only pass a subset leading to TypeError.
- RFC alignment:
rfc-bootstrap-artifacts.mdand governance invariants updates. - Required behavior: EvidenceBundle.build should accept optional invariants/graph (default to []), and the engine should provide invariants/graph when available.
- Implementation notes: Make
invariantsandgraphoptional with default empty lists to protect legacy callers.
- Checklist ID canonicalization
- Observed error: Assertion expecting 8-char stable ID but sees 'TASK-0001' (9 chars);
- Affected tests: tests/test_checklist.py::test_checklist; tests/test_task_id_and_category.py::test_stable_ids
- Affected files:
src/shieldcraft/services/checklist/idgen.py,src/shieldcraft/services/checklist/generator.py - Root cause summary: The generator sometimes uses legacy 'TASK-####' IDs in generated items instead of the canonical
stable_id8-char hash. - RFC alignment:
rfc-checklist-pointer-normalization.mdandrfc-allowed-checklist-types.mdfor migration guidance. - Required behavior: Default item id generation should use deterministic
stable_id(ptr, text)[0:8]for canonical specs; legacy 'TASK-####' can be maintained under a migration flag. - Implementation notes: Replace fallback id generator in
ChecklistGeneratorwithstable_id()and ensure tests expect 8-char IDs or adapt tests tostable_id().
- CodeGenerator output shape
- Observed error: KeyError or other callers expecting outputs format mismatches (KeyError: 0 when content indexed)
- Affected tests: tests/test_codegen_engine.py::test_codegen_outputs, several engine paths
- Affected files:
src/shieldcraft/services/codegen/generator.py,src/shieldcraft/engine.py,src/shieldcraft/services/codegen/emitter/writer.py - Root cause summary: CodeGenerator.run returns variable shapes (list vs dict with
outputs) and callers do not handle all shapes; Writer expects list of dicts. - RFC alignment:
rfc-bootstrap-artifacts.mdand implementation patterns for codegen outputs. - Required behavior:
CodeGenerator.runmust return canonical dict withoutputs: list andcodegen_bundle_hashand engine/writer must expect this shape. - Implementation notes: Unify output shape and add adapter layers for backward compatibility.
- Pointer map semantics (canonical id vs index)
- Observed error:
Pointer mismatches: [ ... ]where pointer map values are numeric indices while spec uses canonical id-based pointers - Affected tests: tests/spec/test_pointer_map.py::test_pointer_map_values_match_task_ptrs
- Affected files:
spec/pointer_map.json,src/shieldcraft/services/ast/builder.py - Root cause summary: Pointer map uses
/sections/1/tasks/0index-based pointers while AST and spec use/sections/ast_construction/tasks/0(ID-based segment). Canonical pointer semantics changed; pointer_map must be canonical or provide bothraw_ptrandcanonical_ptr. - RFC alignment:
rfc-pointer-map-semantics.mdand Phase 13 pointer map canonicalization. - Required behavior:
spec/pointer_map.jsonmust providecanonical_ptrfields or use canonical id-based pointers; or provide both raw + canonical for backward compatibility. - Implementation notes: Update pointer_map entries to include
canonical_ptraligned with AST, or reserializepointer_map.jsonto canonical format.
- Pointer coverage report shape
- Observed error: Coverage report keys missing (test expects
total_pointers,ok_count,missing_countbut gotcountstruct). - Affected tests: tests/spec/test_pointer_missing.py
- Affected code: src/shieldcraft/services/spec/pointer_auditor.py
- Root cause summary:
ensure_full_pointer_coveragereturns a hybrid shape (count dict and missing/ok lists) not the explicit key set expected by tests. - RFC alignment:
rfc-pointer-map-semantics.mddetails required manifest coverage fields. - Required behavior: Return dict with
total_pointers,ok_count,missing_count,ok,missingfor backward compatibility and clarity. - Implementation notes: Provide wrapper or convert return shape to match test expectations.
- JSON canonical formatting (unicode vs \uXXXX escapes)
- Observed error: Re-serialized JSON differs on unicode arrow char vs escaped unicode sequence (
\u2192vs→) and thus fails formatting deterministic check. - Affected tests: tests/spec/test_format_check.py::test_json_formatting_deterministic
- Affected files:
spec/se_dsl_v1.spec.json,spec/pointer_map.jsonetc. - Root cause summary: Original JSON uses unicode escaped sequences; canonicalization uses
ensure_ascii=Falseproducing direct unicode characters. - RFC alignment: Phase 13 spec formatting canonicalization and
determinismpolicy. - Required behavior: Spec files should be canonicalized with
ensure_ascii=False,sort_keys=True,indent=2and saved accordingly in repo. - Implementation notes: Re-serialize relavent spec files and add a pre-commit to enforce canonical formatting.
- Cross-section return type mismatch
- Observed error: TypeError: string indices must be integers, not 'str' in
tests/test_deps_and_cross.pypointing tocross_section_checksreturning string instead of list/dict - Affected tests: tests/test_deps_and_cross.py::test_cross_section_missing_arch
- Affected file:
src/shieldcraft/services/checklist/cross.py - Root cause summary: Function returned a string in some code path (or out-of-spec data type) rather than a list/dict list.
- RFC alignment:
rfc-checklist-pointer-normalization.mdandrfc-pointer-map-semantics.mdmay affect this behavior - Required behavior:
cross_section_checksmust return a list of dict objects each withptrfields. - Implementation notes: Tighten return types; add unit tests to validate types; ensure all code paths return list/dict.
- Self-host manifest completeness & summary missing
- Observed error:
.selfhost_outputs/summary.jsonmissing (schema validation failing earlier led to no summary being created), then manifest missing fields; summary/manifests created only on success. - Affected tests: tests/selfhost/test_selfhost_minimal.py::test_selfhost_minimal_pipeline, other selfhost tests
- Affected files:
src/shieldcraft/main.py,src/shieldcraft/engine.py(manifest building),src/shieldcraft/dsl/schema/manifest.schema.json - Root cause summary: Schema validation fails for spec that uses
spec_formatmapping or missingdsl_version, leading to early exit without summary; subsequent tests expect summary presence. - RFC alignment:
rfc-bootstrap-artifacts.md,rfc-generator-version-contract.md - Required behavior: For self-host runs, validation errors should be surfaced in
errors.jsonandsummary.jsonshould exist (with status failure) for consistent CI handling; manifest schema fields required for determinism should be present or absent deterministically. - Implementation notes: Ensure
run_self_hostwrites a deterministicsummary.jsoneven on validation failures (status: failure + details) and manifest incomplete fields still filled deterministically.
- Each category should be handled as a focused PR aligned with the relevant RFC or as a compatibility PR where RFC exists.
- Priority ordering (recommended):
- Generator lockfile contract behavior
- Engine/DSL mapping (
spec_formatmapping) - EvidenceBundle backward compatibility
- Codegen output shape standardization
- Pointer map canonicalization
- Pointer coverage shape
- Checklist ID canonicalization
- JSON canonical formatting
- Cross-section type enforcement
- Self-host summary completeness
- All categories reference RFCs where relevant and require spec-first changes if they affect the canonical DSL.
- Implementation notes above are non-executable and intended to be used for PR guidance.
- Copilot (automation-assisted triage)
- Validated by present test run logs (pytest captured output) — see artifacts in
artifacts/self_hosting_run_1and/tmp/pytest_full_run.txt.
Status: FROZEN — This triage document is authoritative for Phase 14 failure classifications. No fixes in this phase.