Repository navigation
feat(ops,report,detector,plans): doctrine Slices 2-4 (RCA blocks + Methodology-of-Safety + benchmark evolution) - #232
Merged
Conversation
Slice 2 of PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION: - scripts/lab-completao-orchestrate.ps1: add Write-CompletaoRcaBlock helper and wire it into the failure paths for inventory_preflight, lab_git_ensure_ref, data_contract_preflight, image_preflight, host_smoke, grc_executive_report, grc_export_artifacts. Each block names the phase, message, narrowed hypotheses, next concrete step, and emits a structured rca_<phase> JSONL event so future tooling can grep completao outcomes. - cli/reporter.py: add _emit_rca_block helper for data-boar-report and wire it into (a) the empty --session-id guard, (b) the output-path-escapes-cfg guard, and (c) a generic except wrapper around manifest+report generation. Re-raise after the block to preserve current pytest / CI behaviour. - report/executive_report.py: add a Methodology-of-Safety proof block under section 3 narrating why the existing sample caps and statement timeouts protect the customer DB. Pure narrative around values already on the manifest -- no behavior change. Sample caps and timeouts remain enforced in connectors/sql_sampling.py (_HARD_MAX_SAMPLE = 10_000, timeout clamp <= 60_000 ms) per DEFENSIVE_SCANNING_MANIFESTO.md. Doctrine references: THE_ART_OF_THE_FALLBACK.md (no silent fall-through), INTERNAL_DIAGNOSTIC_AESTHETICS.md (Sysinternals-grade narrative), ACTIONABLE_GOVERNANCE_AND_TRUST.md (the trust triangle: Markdown + manifest YAML + reproducible CLI). Tests: 27 passed across executive_report, scan_audit_log, sql_sampling, and the 200k benchmark guard. Co-authored-by: Fabio Tavares Leitão <[email protected]>
…s (Slice 3) Slice 3 of PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION -- behaviour-preserving: - connectors/sql_sampling.py: top-of-module note + per-function docstrings for resolve_sql_sample_limit and resolve_statement_timeout_ms_for_sampling cite DEFENSIVE_SCANNING_MANIFESTO.md (relief-valve clamps) and THE_ART_OF_THE_FALLBACK.md (strategy labels never silently fall through). The _COMPLIANCE_SCAN_LEADING constant gains a comment recording the DBA-grep contract from manifesto section 4 so future refactors do not drop it. - core/scan_audit_log.py: top-of-module note ties the audit log JSON to DEFENSIVE_SCANNING_MANIFESTO.md (echoes of the relief valves) and ACTIONABLE_GOVERNANCE_AND_TRUST.md (the disclaimer field is the 'system explains itself' discipline). - report/executive_report.py: top-of-module note ties sections 3-4 to ACTIONABLE_GOVERNANCE_AND_TRUST.md (trust triangle), the Methodology-of- Safety block to DEFENSIVE_SCANNING_MANIFESTO.md, and the graceful degradation when manifest fields are missing to THE_ART_OF_THE_FALLBACK.md. No code paths changed. Sample caps (_HARD_MAX_SAMPLE = 10_000) and statement timeout clamp (250..60_000 ms) remain enforced in connectors/sql_sampling.py exactly as before. Tests covering those clamps remain green (31 passed across executive_report, scan_audit_log, sql_sampling, scan_evidence, and the 200k benchmark guard). Co-authored-by: Fabio Tavares Leitão <[email protected]>
… (Slice 4)
Slice 4 of PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION:
- docs/plans/BENCHMARK_EVOLUTION.md gains:
- Header 'Last refreshed: 2026-04-27' bridge to PLAN doctrine.
- Section 3.1 'Pinned 200k A/B (OpenCore vs Pro path) -- direction-only
evidence' with the OpenCore/Pro/speedup table, a Julia-Evans reading
guide so the JSON value (0.574 = OpenCore/Pro time) and the operator
chat phrasing ('0.574x mais lento') agree on direction without
double-inversion, the regression guard reference
(tests/test_official_benchmark_200k_evidence.py), and a doctrinal
interpretation tied to DEFENSIVE_SCANNING_MANIFESTO,
THE_ART_OF_THE_FALLBACK, and ACTIONABLE_GOVERNANCE_AND_TRUST.
- Section 8 'v1.7.3 -> HEAD narrative' separating resilience gains
(RCA blocks in completao + data-boar-report, Methodology-of-Safety
proof block, doctrinal docstrings) from coverage gains (200k A/B
parity guard, audit log echoes of relief valves, strategy labels)
and a pinned-constraints table that names where the
non-negotiable sample caps and statement timeouts live in code.
- Revision log row dated 2026-04-27.
- docs/plans/PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION.md:
- Status line: Slices 1-4 delivered.
- Sequential to-do steps 9-12 marked Done with file pointers.
The 0.574x lab number is integrated as a reading guide and cross-link, not
as a re-run; the immutable JSON artifact and the dated archive at
docs/ops/lab_lessons_learned/LAB_LESSONS_LEARNED_2026_04_27.md remain
untouched per ADR 0042.
No code change in this commit; tests for executive_report, scan_audit_log,
sql_sampling, the 200k benchmark guard, plans-hub-sync, and docs-markdown
remain green (186 passed).
Co-authored-by: Fabio Tavares Leitão <[email protected]>
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Operator handoff (Slack, 2026-04-27) flagged that Slice 1 of
PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION.mdshipped (manifestos + hub wiring) but Slices 2, 3, and 4 were still pending. Constraint: preserve sample caps and statement timeouts (the non-negotiable defensive-scanning relief valves) and integrate the 200k A/B0.574xfigure in theBENCHMARK_EVOLUTION.mdrefresh.This PR delivers all three remaining slices without touching the customer-DB-protecting clamps in
connectors/sql_sampling.py.Slice 2 — RCA blocks (
feat(ops,report))Mark Russinovich would not accept a one-line
failed. Each failure path now writes a Sysinternals-style block (phase, exit, narrowed hypotheses, next concrete step) and a structured event so completão logs are greppable.scripts/lab-completao-orchestrate.ps1— newWrite-CompletaoRcaBlockhelper, wired into the failure paths forinventory_preflight,lab_git_ensure_ref,data_contract_preflight,image_preflight,host_smoke,grc_executive_report, andgrc_export_artifacts. Each writes a structuredrca_<phase>JSONL event underdocs/private/homelab/reports/completao_*_orchestrate_events.jsonl.cli/reporter.py— new_emit_rca_blockhelper, wired into the empty--session-idguard, the output-path-escapes-cfg-dir guard, and a genericexceptaround manifest + report generation. Re-raises so existing pytest / CI behaviour stays the same.report/executive_report.py— new Methodology-of-Safety proof block under section 3 narrating why the existing sample caps and timeouts protect the customer DB. Pure narrative around values already on the manifest. No behaviour change.Slice 3 — Doctrinal docstrings (
refactor(detector,report))Behaviour-preserving comments so future refactors cannot silently drop the contract:
connectors/sql_sampling.py— module note + per-function docstrings onresolve_sql_sample_limit(cap clamp = relief valve) andresolve_statement_timeout_ms_for_sampling(timeout clamp = relief valve);_COMPLIANCE_SCAN_LEADINGconstant gains a comment recording the DBA-grep contract fromDEFENSIVE_SCANNING_MANIFESTO.md§4.core/scan_audit_log.py— module note ties the JSON toDEFENSIVE_SCANNING_MANIFESTO.md(echoes of relief valves) andACTIONABLE_GOVERNANCE_AND_TRUST.md(thedisclaimerfield is the system explains itself discipline).report/executive_report.py— module note ties sections 3-4 toACTIONABLE_GOVERNANCE_AND_TRUST.md(trust triangle), the Methodology-of-Safety block toDEFENSIVE_SCANNING_MANIFESTO.md, and graceful degradation when manifest fields are missing toTHE_ART_OF_THE_FALLBACK.md.Slice 4 —
BENCHMARK_EVOLUTION.mdv1.7.3 → HEAD (docs(plans))speedup_vs_opencore = 0.574(=OpenCore/Protime) and the operator chat phrasing "0.574x mais lento" agree on direction without double-inversion, the regression guard reference (tests/test_official_benchmark_200k_evidence.py), and a doctrinal reading tied toDEFENSIVE_SCANNING_MANIFESTO,THE_ART_OF_THE_FALLBACK,ACTIONABLE_GOVERNANCE_AND_TRUST.PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION.md— Status line: Slices 1-4 delivered; sequential to-do steps 9-12 marked ✅ Done with file pointers.The frozen 2026-04-25 JSON artifact and the dated archive at
docs/ops/lab_lessons_learned/LAB_LESSONS_LEARNED_2026_04_27.mdare untouched per ADR 0042.Defensive Architecture posture (constraints honoured)
_HARD_MAX_SAMPLE = 10_000connectors/sql_sampling.py::_HARD_MAX_SAMPLE250..60_000msresolve_statement_timeout_ms_for_sampling-- Data Boar Compliance Scan_COMPLIANCE_SCAN_LEADINGORDER BYin auto-samplingconnectors/sql_sampling.pycomposition layertests/test_official_benchmark_200k_evidence.pyDoctrine references (Council of Mentors)
docs/ops/inspirations/DEFENSIVE_SCANNING_MANIFESTO.md— NASA SEL · Cloudflare · Steve Gibson.docs/ops/inspirations/THE_ART_OF_THE_FALLBACK.md— Usagi Electric · The 8-Bit Guy.docs/ops/inspirations/INTERNAL_DIAGNOSTIC_AESTHETICS.md— Mark Russinovich (Sysinternals).docs/ops/inspirations/ACTIONABLE_GOVERNANCE_AND_TRUST.md— Tailscale · Charity Majors · Cloudflare post-mortems.Tests run locally
Pre-commit hooks ran on each commit (markdown lint, pt-BR locale, plans-stats freshness, external-tier-no-plan-links, uv lock parity, PII guards, commercial guard, ruff format).
Files
scripts/lab-completao-orchestrate.ps1Write-CompletaoRcaBlockhelper + wiring across seven failure paths.cli/reporter.py_emit_rca_blockhelper + three guard blocks; re-raise preserves CI behaviour.report/executive_report.pyconnectors/sql_sampling.py_COMPLIANCE_SCAN_LEADINGcomment.core/scan_audit_log.pydocs/plans/BENCHMARK_EVOLUTION.mddocs/plans/PLAN_ENGINEERING_DOCTRINE_CONSOLIDATION.mdInspired in form by
linuxmint/live-installer#177/#178(clear symptom → root cause → fix → evidence → defensive constraints → next steps). No invented metrics or dates.