ship: phase-03 l2-modules-and-core-scripts #3
Reference in New Issue
Block a user
Delete Branch "phase/03-l2-modules-and-core-scripts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 03 ship
Creates the 4 L2 composition modules and the 5 core scripts.
L2 modules (each composes 5 L1s):
l2-invoice-service,l2-commodity-price-feed,l2-energy-analytics-api,l2-regulatory-reportingCore scripts:
scripts/policy_checker.py— POLICY_PASS / POLICY_VIOLATION:PUBLIC_INGRESS (REQ-07)scripts/confidence_signal.py— {score: 0.90|0.40, reason} JSON (REQ-08)scripts/evidence_writer.py— canonical-JSON SHA-256 hash chain (REQ-11, D-005/D-023)scripts/mock_executor.sh— invokes L1s, writes state.json (REQ-06)scripts/l3b_agent_stub.py— D-008 keyword map → contract.yaml (D-026)scripts/verify_phase03.sh— 18/18 checks passRequirements covered: REQ-04, REQ-05, REQ-06, REQ-07, REQ-08, REQ-11
Requirements partial: REQ-12 (l3b_agent_stub created; full issue-trigger wiring in Phase 04)
Verification: 4 layers passed, 0 P1 findings.
Version target: v1.0.3 (feature milestone, phase 3 patch)
---ci--- phase: 3 milestone: v1.0 status: clarify decisions: - id: D-020 decision: L2 manifest.yaml schema with l1s: list of {name, inputs: map} rationale: REQ-04 says L2 composes L1s; REQ-05 caps depth at 5 (L2->L1 is depth 1) confidence: 0.90 alternatives: [graph-of-L1s with edges, single flat list of L1 names with no inputs] - id: D-021 decision: contract.yaml schema with stack, inputs, optional public-ingress: bool rationale: REQ-07 cites public-ingress:true as the forbidden key; REQ-08 keys off policy pass/fail confidence: 0.90 alternatives: [separate policy file, contract-free intent] - id: D-022 decision: mock_executor.sh writes state.json with l2, l1s array (name+applied+exit_code), contract rationale: REQ-06 says writes state.json but does not specify shape confidence: 0.85 alternatives: [per-L1 state files, no state file] - id: D-023 decision: evidence_writer.py appends to audit.json (JSON array); each event has seq, ts, stage, event, prev_hash, hash (SHA-256 of canonical JSON); genesis has prev_hash=GENESIS, seq=0 rationale: D-005 mandates hash-chained ledger; canonical JSON for deterministic hashing confidence: 0.90 alternatives: [signed commits only, append-only log file] - id: D-024 decision: confidence_signal.py prints {score, reason} JSON to stdout; exit 0 always rationale: REQ-08 literal: base 0.90, drops to 0.40, gate >= 0.50 confidence: 0.95 alternatives: [exit non-zero on fail, separate side-channel file] - id: D-025 decision: policy_checker.py exits 1 with stdout POLICY_VIOLATION:PUBLIC_INGRESS on public-ingress:true; else exit 0 with stdout POLICY_PASS rationale: REQ-07 literal confidence: 0.99 alternatives: [] - id: D-026 decision: l3b_agent_stub.py reads issue body from argv[1] or stdin, applies D-008 keyword map, writes contract.yaml to stdout (or -o <path>) rationale: D-008 + Act 3 example; L3B must produce same contract format as L3A confidence: 0.90 alternatives: [fixed-output contract per stack, no -o flag] ---/ci--- Phase 03 has real ambiguities (no schema was specified for L2 manifests, contract.yaml, audit.json events, or the L3B output format). Seven decisions logged: D-020 L2 schema, D-021 contract.yaml schema, D-022 state.json shape, D-023 audit.json event + hash chain, D-024 confidence_signal output, D-025 policy_checker output, D-026 l3b_agent I/O contract.---ci--- phase: 3 milestone: v1.0 status: research research: l2_schema: l1s list of {name, inputs: map}; 4 L2s each referencing 5 L1s contract_schema: stack + inputs + optional public-ingress: bool state_json_shape: l2, l1s array (name+applied+exit_code), contract audit_json: JSON array; canonical-JSON SHA-256 hash chain; GENESIS prev_hash core_script_io: 5 scripts with explicit input/output/exit contracts personas: no change; backend-engineer owns core scripts + L2 manifests; infra-stub-engineer owns L1 manifests only ---/ci--- ARCHITECTURE.md gains the L2 manifest schema, the L2 list with per-L2 L1 references (5 each, within max-depth-5), the contract.yaml schema, the state.json shape, the audit.json event + canonical-JSON hash chain, and a core-script I/O contract table. PERSONAS.md is unchanged for Phase 03 (backend-engineer and infra-stub-engineer were both already active in the project-level roster).---ci--- phase: 3 milestone: v1.0 status: plan plan: waves: 3 wave_1_infra_stub: [T-3.1..T-3.4 create 4 L2 manifests] wave_2_backend: [T-3.5 policy_checker, T-3.6 confidence_signal, T-3.7 evidence_writer, T-3.8 mock_executor, T-3.9 l3b_agent_stub] wave_3_coordination: [T-3.10 verify_phase03, T-3.11 traceability] requirements_covered: [REQ-04, REQ-05, REQ-06, REQ-07, REQ-08, REQ-11] must_haves: 9 verification: typecheck: bash -n + python -m py_compile + yaml load test: scripts/verify_phase03.sh build: no-op ---/ci--- PLAN.md replaced with Phase 03 plan. Wave 1 (infra-stub-engineer) creates the 4 L2 manifests. Wave 2 (backend-engineer) creates the 5 core scripts. Wave 3 (lead-developer) wires the verify script + traceability.---ci--- phase: 3 milestone: v1.0 status: verify requirements: covered: [REQ-04, REQ-05, REQ-06, REQ-07, REQ-08, REQ-11] partial: [REQ-12] lessons: - 'set -e' + command substitution kills the parent script when the child exits non-zero, even when 'rc=$?' follows. verify_phase03.sh uses 'set -uo pipefail' (no set -e) so policy_checker's intended exit 1 can be captured. Same pattern recommended for future verify_phaseNN.sh scripts that test negative cases. - 'mock_executor.sh' resolves modules/l2/ relative to cwd, not to the script location. The pipeline (Phase 04) must 'cd' to the repo root before invoking it. Documented in the I/O contract. - Python json.dumps collapses 0.90 -> 0.9; confidence_signal emits the JSON literal as a string to preserve the spec-mandated 0.90/0.40. This is a demo-aesthetic choice; the parsed float is identical. - l3b_agent_stub keyword priority matters: 'gas price' (commodity) wins over 'compliance' (regulatory) because commodity is checked first per D-008. The Act 3 example was crafted to hit this case. review: p0: 0 p1: 0 ---/ci--- Layer 1 STRUCTURAL: PASS (10/10 files; bash -n + py_compile + yaml load clean; no TODO/FIXME). Layer 2 BEHAVIORAL: PASS (verify_phase03.sh 18/18; all 9 PLAN.md must-haves met). Layer 3 SECURITY: PASS (no secrets; subprocess calls use argv lists; hash chain is tamper-evident). Layer 4 QUALITY: PASS (correctness, testing, security, performance, maintainability, adversarial all green). Requirements covered this phase: REQ-04, REQ-05, REQ-06, REQ-07, REQ-08, REQ-11. Partial: REQ-12 (l3b_agent_stub created; full issue-trigger wiring in Phase 04).