Repository navigation
feat(governance): harden governance rules, hook guards, and CI pipeline for epic branching #17
Copy link
Copy link
Closed
Description
feat(governance): harden governance rules, hook guards, and CI pipeline for epic branching
🎯 Context & User Stories (P1 — Product Planner)
Context & Problem Statement
With scripts/seal-issue.sh and scripts/sync-project-metadata.mjs established in Child 1, and templates purged of narrative metadata in Child 2, the delivery kernel now requires authoritative rule hardening and runtime safeguards:
- Rule Ambiguity: Current governance documents (
AGENTS.md,agent-lifecycle.md,backlog-planner.md,git-workflow.md) describe the legacy upfront issue creation and Trunk-Only merge models. - Hook Protection Gaps: Local hooks (
branch-guard.mjs,plan-guard.mjs,pre-invocation-anchor.sh) only protectmainand lack awareness ofepic/**integration branches. - CI Diff Distortion:
delivery-pipeline.ymlcompares PR diffs statically againstorigin/main...HEAD, producing distorted diff sets for PRs targetingepic/**. - Post-Merge Desynchronization:
post-merge-dual-sync.shlacks target base branch detection, leaving working trees onmaininstead of the Epic integration branch. - Metadata Sync Robustness: GraphQL mutations for single-select options in
sync-project-metadata.mjsrequire raw string inlining to avoid GitHub CLI type coercion issues.
User Story 1 (Developer / System Orchestrator)
Feature: Autonomous Governance & Epic Isolation
As a System Orchestrator and Engineer on the Agentic Android Delivery Kernel
I want governance rules, personas, and skills to enforce Just-In-Time sealing and Epic branch isolation
So that specifications remain immutable, project metadata is natively maintained, and epics land atomically without polluting trunk CI.User Story 2 (CI Engine & Airbag)
Feature: Dynamic Diff & Integration Safeguards
As the Delivery CI Engine and Local Git Airbag
I want CI diffs and hook checks to evaluate against the dynamic base branch (${{ github.base_ref }})
So that intermediate child PRs are inspected strictly for their own delta while protecting epic integration branches from direct mutation.Access & Operational Matrix
| Actor | Inception Phase | Child PR Phase | Epic Integration Phase |
|---|---|---|---|
| P1 / P4 | Elaborates local plan (issue: null) |
Consolidates sizing at Pillar 3 | Verifies DAG completion |
| P5 (Dev) | Halted at Gate 1.4 | Branches from epic/**, develops |
Merged into epic/** via child PR |
| P6 (Release) | Verifies WIP = 1 | Opens child PR with skip-release |
Opens final release PR to main |
| CI / Airbag | N/A | Inspects delta vs epic/** |
Full test suite & release trigger |
Pillar 1 · Design Spec (P2 — Design Lead)
Conditional Design Gate:
N/A — No visual/UI changes
Pure governance, rule consolidation, hook safeguards, and CI/CD automation. No@Composable, UI tokens, or visual layouts are modified.
Pillar 2 · Data & Privacy Spec (P3 — Privacy & Data Lead)
- Zero-PII Compliance: No end-user data or credentials handled.
- Audit Logging: Local hook rejections emit structured console alerts with rule violation IDs (
[Rule 0 Violation S-04],[Rule 0.1 Violation E-01]). - Telemetry Taxonomy: No runtime analytics events emitted.
Pillar 3 · Technical Architecture & System Implementation (P4 — System Architect)
1. Governance Rules & Persona Alignment
-
AGENTS.md&agent.md:- Update Phase 1 state machine to reflect local Inception
$\to$ Gate 1.4 Approval$\to$ JIT Sealing viascripts/seal-issue.sh. - Formalize Rule 0 (JIT Issue-First) and Rule 0.1 (Epic Branch Isolation Protocol).
- Update Sequential Persona State Machine diagram.
- Update Phase 1 state machine to reflect local Inception
-
.agent/rules/backlog-planner.md:- Document JIT Sealing lifecycle and sequential child decomposition DAG.
- Detail native GitHub Projects v2 field separation (
Priority,Size,Estimate,Status). - Maintain strict byte budget under 9,500 bytes.
-
.agent/rules/agent-lifecycle.md:- Update 3-Phase Lifecycle with JIT Sealing at Gate 1.4.
- Formalize estimation consolidation in Pillar 3 before scellement.
-
.agent/rules/git-workflow.md:- Document
epic/issue-<id>-<slug>branching convention. - Specify child PR base targeting (
--base epic/...) and final consolidated squash merge tomain.
- Document
-
.agent/personas/p1-product-planner.md&.agent/personas/p4-system-architect.md:- Clarify sizing ownership and collaborative estimation in Pillar 3.
-
.agent/skills/plan-issue/SKILL.md&.agent/skills/open-pr/SKILL.md:- Adapt recipes for JIT sealing execution and dynamic PR base targeting.
2. Local Hooks & Automation Safeguards
-
.agent/hooks/branch-guard.mjs:- Add
epic/*pattern to blocked write branches (getBlockedBranches()). - Prevent direct file modification on
epic/**without a dedicated child feature branch.
- Add
-
.agent/hooks/plan-guard.mjs:- Block direct commits and merges on
epic/*while permitting branch creation and initial upstream tracking push.
- Block direct commits and merges on
-
.agent/hooks/post-merge-dual-sync.sh:- Dynamically detect base branch:
TARGET_BASE=$(gh pr view "$PR_NUMBER" --json baseRefName --jq '.baseRefName' 2>/dev/null || echo "main"). - Automatically check out and pull
TARGET_BASEupon merge, deleting the merged child branch locally and remotely.
- Dynamically detect base branch:
-
.agent/hooks/pre-invocation-anchor.sh:- Distinguish between leaf feature branches and
epic/*integration branches, suppressing the blocking PR review reminder on integration branches during child inception.
- Distinguish between leaf feature branches and
-
scripts/sync-project-metadata.mjs:- Update
updateSelectto use direct query interpolation forsingleSelectOptionId: "${opt.id}"(eliminatinggh api graphqlString! parsing errors).
- Update
3. CI/CD Dynamic Diffing (.github/workflows/delivery-pipeline.yml)
- Update PR trigger to include
epic/**:pull_request: branches: [main, 'epic/**']
- Replace static
origin/main...HEADdiffing with dynamic base reference:BASE_REF="${{ github.base_ref || 'main' }}" CHANGED_FILES=$(git diff --name-only "origin/${BASE_REF}...HEAD")
Pillar 4 · Release Engineering & Verification Plan (P6 — Release Manager)
Quality Airbag & Verification Table
| Verification Step | Command / Assert | Expected Outcome |
|---|---|---|
| Contract Byte Limits | ./scripts/validate-docs.sh |
40/40 contracts PASS, 0 byte budget violations |
| Code Sanity & Compilation | ./scripts/quality-check.sh |
0 errors, 0 lint warnings, 100% tests pass |
| Metadata Sync Single-Select | node scripts/sync-project-metadata.mjs 15 --status Done |
Updates field without GraphQL variable error |
| Branch Guard Verification | Test write simulation on epic/* branch |
Denies direct write with Rule 0.1 violation |
| CI Diff Syntax Verification | Inspect delivery-pipeline.yml YAML validity |
Clean schema validation |
Definition of Done (Child Task 3)
- All 13 governance files and hooks updated and verified.
- All documentation contracts strictly comply with byte budget caps.
-
./scripts/quality-check.shand./scripts/validate-docs.shpass cleanly. - PR opened targeting
epic/issue-12-jit-sealing-epic-protocolwithskip-release. - Gate 3.5 halt observed before squash-merging into the Epic branch.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Activity
feat(governance): harden governance rules, hook guards, and CI pipeli…
epic(governance): establish just-in-time issue sealing, native projec…