commit 7f97cb5fb3379dfa9485edcad5de46dbc2329e76 Author: Prashant Shendre Date: Sat Oct 3 15:56:59 2026 +0530 Hardening the process diff --git a/.agents/skills/up-arch-risk-spike/SKILL.md b/.agents/skills/up-arch-risk-spike/SKILL.md new file mode 100644 index 0000000..3f404f5 --- /dev/null +++ b/.agents/skills/up-arch-risk-spike/SKILL.md @@ -0,0 +1,63 @@ +--- +name: up-arch-risk-spike +description: Score every use case on architectural risk (data isolation/multi-tenancy, external integration dependency, financial/transactional sensitivity, high-volume/real-time streaming, novelty/complexity), shortlist architecturally significant ones, then build and validate a thin end-to-end architecture walking skeleton (HLD + LLD + deployment) against only that shortlist before full-breadth design begins. Covers Stages 6-7 (Elaboration) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-arch-risk-spike — Stages 6–7 (Elaboration) + +## Objective + +Retire architecture risk early by proving the hardest parts of the system (data isolation, highest-risk integrations, state machines, high-volume data paths) against a small, representative slice of use cases — before committing full design effort across all use cases. + +## When to invoke + +- After `up-traceability-gate` (Gate 5.1) passes for the use-case set in scope. +- In Greenfield projects: can be run as Stage 1B/6 to validate the core walking skeleton. +- Before `up-srs-derive` (Stage 8) and `up-hld-lld-generate` (Stage 9) begin full-breadth design. + +## Read first + +- `tech-profile.yaml` (identifies architecture pattern, database model, auth provider, and external sandboxes) +- `04_generated_documentation/03_requirements/use_cases/` (all authored use cases) +- `04_generated_documentation/00_process_control/master_context.md` +- `00_prompts/AI_Native_Unified_Process_v1.md` §5 "Stage 6" and "Stage 7" + +## Procedure + +**Stage 6 — Architectural Risk Ranking:** + +Read every use case and evaluate against 5 standard architectural risk dimensions (scored 1 to 5): +1. **Data Isolation & Multi-Tenancy:** Cross-tenant boundaries, Row-Level Security, or schema isolation complexity. +2. **External Integration Dependency:** Third-party APIs, webhooks, payment gateways, messaging systems. +3. **Financial & Transactional Sensitivity:** Balances, ledgers, irreversible state transitions, atomic operations. +4. **Throughput & Concurrency:** Real-time ingestion, streaming, heavy background queues, lock contention. +5. **Novelty & Technical Uncertainty:** Unfamiliar algorithms, complex business logic, or lack of precedent. + +Compute total `RISK-xxx` score. Mark the top 15–20% (or any UC scoring 4–5 on any single dimension) as "Architecturally Significant" in `00_process_control/architecture_risk_register.md`. + +**Stage 7 — Architecture Spike / Walking Skeleton:** + +Using only the architecturally significant use cases, design: +1. Architecture component boundaries (HLD) matching `tech-profile.yaml` architecture pattern. +2. LLD detail (internal APIs, database schema, domain events, state machines) for these components. +3. Explicitly validate: data-scoping models, authentication/token propagation, sandbox mock contracts, and error resilience. + +Produce `architecture_spike_report.md` documenting: +- Validated architectural patterns and baseline service templates (folder layouts, API contract shapes, repository patterns). +- Invalidated assumptions, logged as `DEC-xxx` or `AMB-xxx`. + +## Output expected + +`04_generated_documentation/00_process_control/architecture_risk_register.md`; scoped `04_generated_documentation/04_architecture_design/hld.md` and `lld/LLD-xxx_*.md` covering significant use cases; `architecture_spike_report.md`. + +## Exit criteria + +Architecturally significant use cases have a validated walking skeleton HLD/LLD; service template is documented; human lead signs off on spike findings. + +## Sample invocation + +> "Run up-arch-risk-spike against all authored use cases to identify high-risk integration and data-isolation bottlenecks." + +## Related skills + +Previous: `up-traceability-gate` (Gate 5.1). Next: `up-srs-derive` (Stage 8), then `up-hld-lld-generate` (Stage 9). diff --git a/.agents/skills/up-brd-extract/SKILL.md b/.agents/skills/up-brd-extract/SKILL.md new file mode 100644 index 0000000..4823768 --- /dev/null +++ b/.agents/skills/up-brd-extract/SKILL.md @@ -0,0 +1,51 @@ +--- +name: up-brd-extract +description: Extract every distinct business feature, requirement, and constraint from the Business Requirements Document (BRD/PRD) and assign each a BRD-FR-xxx ID — the root of the traceability chain. Use this right after up-project-bootstrap, whenever the BRD is updated/re-versioned (e.g. "BRD v2"), or whenever you need to confirm what the BRD authoritatively requires before touching legacy code. This is Stage 1 (Inception) of the UP-AI v1.0 Unified Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-brd-extract — Stage 1 (Inception) + +## Objective + +Extract the authoritative business features from the BRD/PRD and assign each one a `BRD-FR-xxx` ID. The BRD becomes the primary reference for the target system — it overrides legacy behavior wherever they conflict. + +## When to invoke + +- Immediately after `up-project-bootstrap` (Stage 0). +- Whenever a new or revised PRD/BRD version arrives — re-run scoped to the diff, and raise a `CR-xxx` via `up-change-request-impact` for anything that changes previously-extracted `BRD-FR-xxx` items. + +## Read first + +- `01_BRD/` (full PRD/BRD contents) +- `04_generated_documentation/00_process_control/master_context.md` (from Stage 0) +- `00_prompts/AI_Native_Unified_Process_v1.md` §4 "Stage 1" + +## Procedure + +Read `01_BRD` in full. Extract every distinct business feature, requirement, and constraint. For each, assign a `BRD-FR-xxx` ID and record: +- statement +- BRD/PRD section reference +- actor(s) involved +- priority (if stated) +- whether it overlaps/conflicts with a legacy capability (flag only — resolution happens in `up-legacy-gap-analysis`) + +Rules: +- Do not reference legacy code or screenshots in this pass — BRD extraction must be independent of legacy anchoring. +- Do not resolve conflicts here — only flag them. +- Output as a table in `04_generated_documentation/01_source_inventories/brd_inventory.md`. + +## Output expected + +`04_generated_documentation/01_source_inventories/brd_inventory.md` — every BRD feature tagged `BRD-FR-xxx`. + +## Exit criteria (QG-0 equivalent) + +Every BRD feature has a `BRD-FR-xxx` ID. None are yet mapped downstream — that begins at Stage 5 (`up-use-case-author`). + +## Sample invocation + +> "Run up-brd-extract against the current 01_BRD folder and produce brd_inventory.md." + +## Related skills + +Previous: `up-project-bootstrap` (Stage 0). Next: `up-use-case-author` (Stage 5) for Greenfield, or `up-legacy-gap-analysis` (Stages 2–4) for Brownfield. diff --git a/.agents/skills/up-change-request-impact/SKILL.md b/.agents/skills/up-change-request-impact/SKILL.md new file mode 100644 index 0000000..944d1d7 --- /dev/null +++ b/.agents/skills/up-change-request-impact/SKILL.md @@ -0,0 +1,108 @@ +--- +name: up-change-request-impact +description: Raise a formal Change Request (CR-xxx) for any bug fix that's actually a requirements gap, new BRD ask, NFR change, or scope adjustment arriving after baseline, and compute its full blast radius by walking the traceability graph BEFORE any document is edited. Use this any time a change is proposed at any stage of the process - during Elaboration, mid-iteration in Construction, during an iteration retrospective, during UAT, or even after production handover. This is the cross-cutting mechanic that keeps the process robust against unforeseen future change. Covers UP-AI v1.0 (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-change-request-impact — Cross-cutting (any stage, any phase) + +## Objective + +Give every future change — a bug that's really a requirements gap, a new ask from the BRD owner, an NFR change, a process adjustment — a single, structural entry point: raise it as `CR-xxx`, compute exactly what it touches by walking the traceability graph, get it approved, then apply only the computed delta. This guarantees all upstream and downstream artifacts remain synchronized. + +## When to invoke + +- A defect in `up-defect-fix` turns out to be a requirements gap, not a coding error. +- A new BRD ask arrives mid-program (new feature, changed business rule). +- An NFR needs to change (e.g., a new compliance requirement, a performance target revision). +- An iteration retrospective (`up-iteration-plan`'s loop) surfaces something that represents a scope or requirement change. +- A review during `up-arch-risk-spike`, `up-srs-derive`, or `up-hld-lld-generate` invalidates a prior assumption. +- **Any time — including after Transition/production handover.** + +## Read first + +- `04_generated_documentation/00_process_control/change_request_register.md` +- `04_generated_documentation/00_process_control/traceability_graph.md` +- The artifact(s) where the change originates + +## Procedure + +### Step 1 — Raise the CR + +Create a new row in `change_request_register.md`: + +| Field | Value | +|---|---| +| CR-ID | next `CR-xxx` | +| Trigger Type | Bug / New-BRD-Ask / NFR-Change / Process-Adjustment | +| Raised By | AI / Human / Joint, date, originating stage/iteration | +| Description | what is being requested or what broke | +| Disposition | starts at "Proposed" | + +### Step 2 — Impact Analysis (before editing anything) + +``` +A change has been proposed: [CR-xxx description]. + +It touches [UC-xxx / FR-xxx / SRS-xxx / HLD component / other — name +the starting point(s) you know about]. + +Walk 04_generated_documentation/00_process_control/traceability_graph.md from every starting point +given. Report: +1. Every downstream artifact reachable in the chain (FR -> SRS -> HLD -> + LLD -> STORY -> TC -> UAT) that would need to change. +2. Every upstream artifact (BRD-FR, other UCs sharing a business rule or + screen) that should be checked for consistency. +3. Any iteration already in progress or completed that delivered an + affected FR - flag for re-verification, not just re-documentation. +4. A recommended disposition. + +Do not edit any document yet. Output this as the Impact Analysis section +of CR-xxx in change_request_register.md. +``` + +### Step 3 — Disposition (human checkpoint) + +Set Disposition to Approved / Deferred / Rejected. Even a one-person "CCB" is a logged approval — do not skip straight from Impact-Analyzed to editing documents. + +When working on a source branch named in `parallel_work_plan.md`, record a new `CR-xxx` as branch-local/provisional in the lane transcript and handoff. It becomes canonical after `up-parallel-work-integrate` checks for collisions. + +### Step 4 — Re-baseline (only the computed impacted set) + +``` +You previously generated: [OUTPUT_FILE_NAME] +Now apply: CR-xxx, per its approved Impact Analysis (list of exactly +which artifacts are affected). + +Task: update only the affected sections identified in the Impact +Analysis - nothing outside that list. + +Rules: +- Do not regenerate the full document. +- Show changed sections only. +- Maintain existing IDs; add new IDs only where the Impact Analysis says + a new artifact is needed. +- Bump the version field and set last_cr = CR-xxx on every file touched. +- Preserve traceability. +``` + +### Step 5 — Verify and close + +If the CR affected an already-Delivered FR, re-run `up-traceability-gate` (Gate 14.1 semantics) against the affected iteration before marking CR-xxx "Verified" then "Closed." + +## Output expected + +Updated `change_request_register.md` entry (all fields through Closed); updated artifacts limited to the Impact Analysis's computed set, each with bumped version. + +## Exit criteria + +CR reaches "Closed" with every impacted artifact re-baselined and re-verified; no artifact outside the computed impact set was touched. + +## Sample invocation + +> "Raise a CR: client requested OAuth2 Social Login support. Run the Impact Analysis against UC-001 and any HLD/LLD tied to auth before we touch anything." + +> "DEF-002's root cause is that UC-003's status FSM is missing a transition rule, not a code bug — raise CR-001 citing UC-003/FR-AUTH-003, run Impact Analysis, and hold for approval before re-baselining." + +## Related skills + +Can be invoked from: `up-defect-fix`, `up-iteration-plan` (via retrospective), `up-brd-extract` (BRD revision), `up-arch-risk-spike`/`up-srs-derive`/`up-hld-lld-generate` (invalidated assumption), `up-uat-handover` (post-UAT finding), or standalone. Always precedes the re-baseline of whichever authoring skill owns the affected artifact. diff --git a/.agents/skills/up-code-generate/SKILL.md b/.agents/skills/up-code-generate/SKILL.md new file mode 100644 index 0000000..e2da363 --- /dev/null +++ b/.agents/skills/up-code-generate/SKILL.md @@ -0,0 +1,67 @@ +--- +name: up-code-generate +description: Generate production-grade backend services, frontend views/screens, database migrations, API contracts, and integration adapters for the stories in the current iteration's backlog, with explicit delivery-surface coverage across portal/frontend, API, data, integration, infrastructure, and QA. Use this after up-wireframe-spec and up-test-model-generate have produced the iteration's screens, surface matrix, and test cases. Covers Stage 13 (Construction) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-code-generate — Stage 13 (Construction, per iteration) + +## Objective + +Implement the current iteration's stories as production-grade code — backend services, frontend screens/views, database migrations, API contracts, and integration adapters — adhering to the technology stack configured in `tech-profile.yaml` and requirement-driven development principles. + +## When to invoke + +- After `up-wireframe-spec` and `up-test-model-generate` have produced this iteration's screens and test cases. +- Repeatedly within an iteration, once per story or logical group of related stories. + +## Read first + +- `tech-profile.yaml` (specifies backend language, framework, ORM, migrations, frontend framework, auth provider, and sandboxes) +- Current iteration's `04_generated_documentation/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md` (STORY-xxx list) +- Current iteration's `iteration_surface_matrix.md` (required delivery surfaces and owners) +- Current iteration's `parallel_work_plan.md` (if parallel lanes are active) +- Owning `04_generated_documentation/04_architecture_design/lld/LLD-0xx_*.md` (API/table/event contracts) +- Owning use case's `functional-reqs.md` (acceptance criteria, validation, audit requirements) +- This iteration's wireframes (`04_generated_documentation/06_wireframes/`) and test cases (`04_generated_documentation/07_test_design/`) +- `04_generated_documentation/06_wireframes/DESIGN.md` or active design system tokens +- `architecture_spike_report.md` (service template conventions) + +## Procedure + +Pick the next `STORY-xxx` with status "Ready" from the iteration backlog. Implement only that story (or related group) per invocation: + +Confirm every applicable surface in `iteration_surface_matrix.md` has an owner and repository path. If the story requires a frontend screen, frontend code is mandatory unless an approved `CR-xxx`/`DEC-xxx` explicitly defers it. + +**Backend service generation:** Implement against the LLD API contract exactly — request/response shapes, status codes, error format, RBAC checks, tenant-context propagation, validation, and audit logging. Use the backend language/framework specified in `tech-profile.yaml`. Write unit and integration tests covering the story's acceptance criteria. Add or update API collections (Bruno `.bru` or OpenAPI spec) for added/changed endpoints. + +**Frontend screen generation:** Implement against the iteration's wireframe/field-level spec — fields, validation, navigation, error states. Reuse `DESIGN.md` component library and tokens. Write corresponding component and browser-E2E tests (e.g. Playwright) tagged with `UC-xxx`/`FR-xxx`/`STORY-xxx`. + +**Database implementation:** Generate migrations matching the LLD table definitions via the migration tool in `tech-profile.yaml` (e.g. Alembic, Prisma, Flyway); do not hand-edit schema outside migrations. + +**Integration adapters:** Implement external API triggers, requests, and failure handling against the contracts in `tech-profile.yaml`. Consume and verify against the Wave 0 Sandbox/Mock adapters so test suites run 100% deterministically and offline without external API dependencies. + +Rules (apply to every story): +1. Do not introduce unrelated changes or refactor unrelated files. +2. Write unit/integration/contract/smoke/browser-E2E tests assigned to this story by `up-test-model-generate`. +3. Implement validation, error handling, structured logging, and audit trails where the FR requires it. +4. Enforce tenant isolation and authorization per the architecture spike's validated pattern. +5. Update `iteration_surface_matrix.md` with implementation status and verification evidence. +6. Do not place secrets, live tokens, or production credentials in code, fixtures, logs, or commits. +7. **Automated Test Coverage Budgets:** Ensure code meets the thresholds configured in `tech-profile.yaml`: + - Backend Domain & FSMs: **≥95.0%** statement and branch coverage. + - Integration Adapters: **≥90.0%** against Wave 0 sandboxes. + - Frontend UI Components: **≥80.0%** component branch coverage + mandatory Playwright browser-E2E tests for primary user journeys. + Exercise Happy Path, Alternate/Boundary, Failure, and FSM Invariant scenarios. + +## Output expected + +Source code changes; updated OpenAPI / Bruno specs; DB migrations; frontend portal artifacts; updated `iteration_surface_matrix.md`; execution log. + +## Exit criteria + +Story implemented per LLD contract and screen spec across every applicable surface; API, data, integration, and frontend artifacts are synchronized; tests achieve configured coverage thresholds; ready for `up-defect-fix` and Gate 14.1. + +## Related skills + + +Previous: `up-wireframe-spec`, `up-test-model-generate`. Next: `up-defect-fix` (code review, defect handling), then `up-traceability-gate` (Gate 14.1). diff --git a/.agents/skills/up-context-checkpoint/SKILL.md b/.agents/skills/up-context-checkpoint/SKILL.md new file mode 100644 index 0000000..85e2412 --- /dev/null +++ b/.agents/skills/up-context-checkpoint/SKILL.md @@ -0,0 +1,78 @@ +--- +name: up-context-checkpoint +description: Save or resume a lightweight checkpoint of in-progress AI-agent work — which stage/iteration is active, what was just completed, what's mid-flight, what decisions are still pending, and the exact next action — so a new session (or a different agent) can rehydrate context and continue without re-deriving it from scratch. Use this at the end of any work session before context runs low or before handing off, and at the start of any session that continues prior work. This is a cross-cutting mechanic supporting AI-agent-driven development with agents/skills/templates in UP-AI v1.0 (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-context-checkpoint — Cross-cutting (any stage, any phase) + +## Objective + +Give AI-agent-driven work a cheap, structured way to pause and resume without losing context — what stage of the process is active, which artifacts are mid-authoring, which decisions are still open, and exactly what to do next. + +A checkpoint is not a substitute for governance registers and not a duplicate of them — it's a short pointer document that says which stage/skill was running, what it had just done, what it was about to do, and which of the other registers to consult for the substance. Keep it concise. + +## When to invoke + +**Save a checkpoint:** +- At the natural end of a work session. +- Before context is about to run low mid-task. +- Before handing off to a different agent/session/developer. +- Immediately before anything requiring human input that will pause work for an unknown duration. + +**Resume a checkpoint:** +- At the start of any session continuing prior work — read the latest checkpoint before doing anything else. + +## Read first + +- `04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md` (pointer to the latest checkpoint, if any) +- The referenced registers named in that checkpoint (`traceability_graph.md`, `change_request_register.md`, `decision_log.md`, `ambiguity_register.md`, current iteration's `iteration_backlog.md`) + +## Procedure + +### Saving a checkpoint + +``` +Write a checkpoint for the current work session to +04_generated_documentation/00_process_control/checkpoints/checkpoint--.md: + +- Checkpoint ID: CKPT- +- Date, and which stage/gate/iteration was active +- What was just completed this session (short list of artifacts created/updated with paths) +- What is mid-flight / partially done +- Open items blocking progress (pointers to CR-xxx, AMB-xxx, or DEC-xxx) +- The exact next action: which skill to invoke, with what scope/args + +Update 04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md to point to +this checkpoint as the latest. +``` + +### Resuming a checkpoint + +``` +Read 04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md to find the +latest checkpoint, then read that checkpoint file. + +Before continuing: +1. Verify the checkpoint's "what was just completed" list matches repo state. +2. Check whether referenced pointers (CR-xxx, AMB-xxx, DEC-xxx) have been resolved. +3. If the next action is still valid, execute it; if stale, propose the corrected next action. +``` + +## Output expected + +`04_generated_documentation/00_process_control/checkpoints/checkpoint--.md`; updated `checkpoint_index.md`. + +## Exit criteria + +**Save:** the checkpoint file exists, the index points to it, and the "next action" is concrete. +**Resume:** the checkpoint has been verified against current repo state and executed. + +## Sample invocation + +> "We're stopping here for today — save a checkpoint. We just finished UC-001's architecture spike validation; UC-002 through UC-005 still need up-use-case-author before Gate 5.1 can be re-run across the full authentication slice." + +> "Starting a new session — resume from the last checkpoint and tell me what's next." + +## Related skills + +Usable alongside any other skill in the process. diff --git a/.agents/skills/up-defect-fix/SKILL.md b/.agents/skills/up-defect-fix/SKILL.md new file mode 100644 index 0000000..5b1fc9e --- /dev/null +++ b/.agents/skills/up-defect-fix/SKILL.md @@ -0,0 +1,59 @@ +--- +name: up-defect-fix +description: Review code from the current iteration and fix approved defects one at a time, including real-runtime API and browser-E2E portal findings, escalating to a Change Request whenever the root cause turns out to be an incomplete or wrong requirement rather than a coding mistake. Use this after up-code-generate has produced a story's implementation, during code review, QA, or UAT of the current iteration. This is Stage 14 (Construction) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-defect-fix — Stage 14 (Construction, per iteration) + +## Objective + +Review and fix defects for the current iteration's code, and correctly distinguish a coding bug (fix in code, done) from a requirements gap (the FR/UC itself was incomplete or wrong — must be raised as a `CR-xxx`, not just patched). + +## When to invoke + +- After `up-code-generate` produces a story's implementation, as part of code review. +- During QA or UAT of the current iteration, for any defect logged against iteration code. + +## Read first + +- `defect_register.md` / `code_review_log.md` (iteration-scoped) +- Related source code +- Related `functional-reqs.md` (the FR the defect's story implements) +- Related `TC-xxx` test cases +- Current iteration's `iteration_surface_matrix.md` + +## Procedure + +Fix the next approved defect from the defect register. + +Pick the first defect with Status = "Approved for Fix." Fix only that defect. + +Rules: +1. Do not introduce unrelated changes or refactor unrelated files. +2. Preserve existing behavior unless the defect requires correction. +3. Add a targeted regression test to prevent recurrence (coordinate with `up-test-model-generate`), then run the regression suite scoped to the affected `UC-xxx`/`FR-xxx` via `scripts/run_tests.sh --scope uc-xxx` before closing the defect. +4. Update documentation if behavior changes. +5. Update traceability if requirement coverage changes. +6. If the defect exposes an unimplemented frontend/API/data/integration/runtime surface, update the surface matrix and treat it as a blocking integration finding until implemented or explicitly deferred by `CR-xxx`/`DEC-xxx`. + +**Before closing the defect, classify the root cause:** +- If the root cause is a coding error (logic bug, missed edge case the requirement already specified) → fix in code as normal. +- **If the root cause is that the requirement itself was incomplete, ambiguous, or wrong — do not just fix the code.** Raise `CR-xxx` via `up-change-request-impact`, citing the `FR-xxx`/`UC-xxx` that needs correction, get its impact analyzed and approved, and only then apply the code fix alongside the requirement correction. + +For the defect fix, provide: Defect ID, root cause, files changed, fix implemented, tests added/updated, verification steps, regression risk, requirement references. + +## Output expected + +Code fix; updated defect register and traceability entries; a `CR-xxx` if the defect was requirements-rooted. + +## Exit criteria + +Defect closed with root cause documented; real-runtime/API/browser-E2E regression evidence added where applicable; the affected surface matrix row is current; if requirements-rooted, the linked `CR-xxx` shows disposition Approved/Re-baselined/Verified. + +## Sample invocation + +> "Run up-defect-fix for DEF-002 (order status transitions to CANCELLED from an invalid state) — check whether this is a code bug or whether UC-003's status FSM itself is missing this transition rule." + +## Related skills + +Previous: `up-code-generate`. Next: `up-traceability-gate` (Gate 14.1). If requirements-rooted: `up-change-request-impact`. diff --git a/.agents/skills/up-hld-lld-generate/SKILL.md b/.agents/skills/up-hld-lld-generate/SKILL.md new file mode 100644 index 0000000..79b9ff8 --- /dev/null +++ b/.agents/skills/up-hld-lld-generate/SKILL.md @@ -0,0 +1,47 @@ +--- +name: up-hld-lld-generate +description: Design HLD/LLD for the remaining, non-architecturally-significant use cases by applying the validated service template from the architecture spike, rather than architecting each module independently from scratch. Use this after up-srs-derive has produced SRS/NFR requirements for the full FR set, following the up-arch-risk-spike walking skeleton. This is Stage 9 (Elaboration) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-hld-lld-generate — Stage 9 (Elaboration) + +## Objective + +Complete HLD/LLD for all remaining modules by reusing the pattern already proven in the Stage 7 architecture spike (`up-arch-risk-spike`) — folder/module layout, internal API contract shape, tenant-scoping data-model convention, event/queue conventions — instead of re-deriving architecture decisions independently per module. + +## When to invoke + +- After `up-arch-risk-spike` has published `architecture_spike_report.md` with a validated service template, and `up-srs-derive` has produced SRS/NFR for the FRs in scope. +- When a new use case is added later (via an approved `CR-xxx`) and needs HLD/LLD fitted to the existing template. + +## Read first + +- `architecture_spike_report.md` (service template and validated patterns) +- `04_generated_documentation/00_process_control/architecture_risk_register.md` (which use cases are NOT architecturally significant) +- `04_generated_documentation/03_requirements/use_cases/` (FR-xxx with derived SRS from Stage 8) +- `00_prompts/AI_Native_Unified_Process_v1.md` §5 "Stage 9" + +## Procedure + +Apply the service template and validated patterns from `architecture_spike_report.md` to the remaining use cases (those NOT marked "Architecturally Significant" in `architecture_risk_register.md`). + +For each remaining service/module: +- Follow the same folder/module layout, API contract shape, tenant-context propagation, and event/queue conventions already proven in the spike. +- Do not re-derive tenant isolation or integration patterns from scratch — reference the spike's decisions (`DEC-xxx`) directly. +- If a remaining use case does not fit the template, raise it back to `architecture_risk_register.md` and treat it as an unplanned architecturally significant case requiring its own mini-spike (`up-arch-risk-spike`) before proceeding here. + +## Output expected + +Completed `04_generated_documentation/04_architecture_design/hld.md`, `lld/LLD-0xx_*.md` (all services), `database_design.md`, `api_design.md`, `integration_design.md`. + +## Exit criteria + +Every FR resolves to an HLD component and an LLD artifact — checked by `up-traceability-gate` (Gate 9.1), which must pass before Construction begins. + +## Sample invocation + +> "Run up-hld-lld-generate for the remaining use cases not marked architecturally significant — apply the tenant-scoped module template from architecture_spike_report.md to the User Settings and Notification modules." + +## Related skills + +Previous: `up-arch-risk-spike` (Stage 7), `up-srs-derive` (Stage 8). Next: `up-traceability-gate` (Gate 9.1), then Construction begins with `up-iteration-plan` (Stage 10). diff --git a/.agents/skills/up-iteration-plan/SKILL.md b/.agents/skills/up-iteration-plan/SKILL.md new file mode 100644 index 0000000..54f197e --- /dev/null +++ b/.agents/skills/up-iteration-plan/SKILL.md @@ -0,0 +1,67 @@ +--- +name: up-iteration-plan +description: Select the next iteration's vertical slice of 3-8 related use cases and produce a scoped iteration backlog, plan, and delivery-surface matrix covering frontend portals, APIs, data, integrations, infrastructure, and QA. Use this at the start of every Construction iteration, including the very first one once the Elaboration exit gate (QG-E) has passed. This is Stage 10 (Construction) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-iteration-plan — Stage 10 (Construction, loop entry point) + +## Objective + +Plan one iteration at a time — a vertical slice of related use cases taken end-to-end to working, demoable, integrated software — instead of authoring the entire program's backlog and sprint schedule once, up front. + +## When to invoke + +- At the start of Construction, immediately after the Elaboration Exit Gate (QG-E) passes. +- At the start of every subsequent iteration, once the previous iteration's retrospective is done. +- Never author more than one iteration's backlog in a single pass — planning iteration N+2 before iteration N's retrospective defeats the purpose of the loop. + +## Read first + +- `04_generated_documentation/00_process_control/architecture_risk_register.md` (grouping/dependency data) +- `04_generated_documentation/00_process_control/traceability_graph.md` (which FRs/use cases are not yet Delivered) +- Previous iteration's `retrospective.md`, if any (carried-over stories, raised CRs) +- `04_generated_documentation/07_test_design/regression_test_cases.md` (flaky or deprecated-pending-replacement regression debt to carry forward) +- `00_prompts/AI_Native_Unified_Process_v1.md` §6 "Stage 10" + +## Procedure + +Using `architecture_risk_register.md`'s grouping data and the current state of `traceability_graph.md`, select the next 3–8 related use cases not yet delivered (`status != Delivered`) for `iteration-NN`. + +Prefer grouping by shared HLD service or BRD epic to minimize cross-service coordination within the iteration. + +Produce `iteration_backlog.md`: for each `UC-xxx` in scope, list its `FR-xxx` children as `STORY-xxx` entries (story points, priority, acceptance criteria carried from the FR). + +Produce `iteration_plan.md`: iteration goal (one sentence), demo criteria (what will be shown working at the end), capacity, any carried-over stories from the previous iteration's retrospective, and any carried-over regression debt from `regression_test_cases.md`. + +When two or more implementation lanes are proposed, produce `parallel_work_plan.md` before Stage 13. For each lane record: owner; STORY-xxx and surfaces; allowed paths/modules; shared artifacts and their single owner; required contracts; dependencies; isolated branch/worktree and test data/environment; target master lane branch and common base SHA; source branch name and expected handoff SHA; merge order; and lane completion evidence. + +Produce `iteration_surface_matrix.md` for every FR/story with at least: +`FR | STORY | actor/portal | screen/route | API | database/migration | integration/dependency | runtime/configuration | unit/API-integration/browser-E2E/operational test | owner | status`. + +For each web actor named by the FR or demo criteria, name the actual portal and route/screen. Mark a surface deferred or not applicable only with an explicit reason and approved `CR-xxx`/`DEC-xxx`. + +Rules: +- Do not plan an iteration around use cases that haven't passed Gate 9.1 (FR↔SRS↔HLD↔LLD completeness). +- Do not silently drop a carried-over story from the last retrospective. +- Do not silently drop regression debt. +- Do not leave a delivery surface implicit: frontend portal/screen, API/backend, database, integration, infrastructure/configuration, and QA/observability must each be classified. +- Do not schedule concurrent AI-assisted work without an approved `parallel_work_plan.md`. +- For any iteration touching external third-party APIs (e.g. Identity Providers, e-KYC services, payment gateways, ERP connectors, messaging/notification services), Wave 0 in `parallel_work_plan.md` MUST explicitly schedule and scaffold deterministic Sandbox/Mock adapters under `app/integrations/sandbox/` before business logic lanes execute. + +## Output expected + +`04_generated_documentation/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md`, `iteration_plan.md`, `iteration_surface_matrix.md`, and `parallel_work_plan.md` when concurrent lanes are planned. + +## Exit criteria + +Iteration scope selected and agreed; every story traces to an FR-xxx that passed Gate 9.1; no applicable delivery surface is unclassified; every in-scope web portal/screen has an implementation owner and browser-QA owner; every concurrent lane has an approved boundary, dependency, integration order, and evidence plan. + +## Sample invocation + +> "Run up-iteration-plan for iteration-02. Group by the Account & Billing HLD service since iteration-01's retrospective flagged user-account stories as a good next dependency cluster." + +> "This is the first Construction iteration — run up-iteration-plan now that QG-E has passed, prioritizing the Authentication and User Profile use cases since they unblock the most downstream stories." + +## Related skills + +Previous: `up-hld-lld-generate` + `up-traceability-gate` (Gate 9.1) for the first iteration; the previous iteration's retrospective for subsequent ones. Next: `up-wireframe-spec` and `up-test-model-generate` (Stage 11/12, can run in parallel), then `up-code-generate` (Stage 13). diff --git a/.agents/skills/up-legacy-gap-analysis/SKILL.md b/.agents/skills/up-legacy-gap-analysis/SKILL.md new file mode 100644 index 0000000..06729aa --- /dev/null +++ b/.agents/skills/up-legacy-gap-analysis/SKILL.md @@ -0,0 +1,63 @@ +--- +name: up-legacy-gap-analysis +description: Inventory legacy modules, APIs, AST source structures, and database schema from legacy repositories, mine legacy screenshots for screen flows, and produce the BRD-vs-legacy gap/conflict analysis for Brownfield modernization projects. Use this after up-brd-extract on Brownfield tracks, whenever a legacy module needs deep analysis, or when a new screenshot set arrives. Covers Stages 2-4 (Inception) of the UP-AI v1.0 Process. (Note: Skipped for Greenfield projects). +--- + +# up-legacy-gap-analysis — Stages 2–4 (Inception: Brownfield Track) + +## Objective + +Build a catalogued, indexed understanding of the legacy system (modules, APIs, DB schema, screens) and reconcile it against the PRD/BRD-FR inventory from Stage 1 — producing the authoritative conflict/gap list that Stage 5 (`up-use-case-author`) will consume. This applies to **Brownfield Modernization / Migration** initiatives. + +*(Note: For Greenfield 0-to-1 initiatives, skip Stages 2–4 and proceed directly to Domain Modeling and Stage 6 Architecture Spike).* + +## When to invoke + +- On Brownfield projects after `up-brd-extract` has produced `brd_inventory.md`. +- When a specific legacy module needs its behavior extracted in more depth. +- When legacy screenshots or UI assets arrive for a portal/client application. + +## Read first + +- `tech-profile.yaml` (identifies legacy source paths under `inception.legacy_sources`) +- `04_generated_documentation/01_source_inventories/brd_inventory.md` +- `02_legacy_source_code/` (the specific module folder(s) in scope) +- `03_old_screenshots/` (if UI screenshots are available) +- `00_prompts/AI_Native_Unified_Process_v1.md` §4 "Stages 2–4" + +## Procedure + +Run as three scoped passes — do not combine them into one prompt (token discipline): + +**Stage 2 — Legacy System Inventory** (one module or catalogue type at a time): +1. Folder & AST inventory: catalogue applications/modules present, purpose, architecture pattern, apparent tech stack. +2. API catalogue: enumerate endpoints per module (method, path, request/response models, auth mechanisms). +3. DB catalogue: reconstruct schema/tables per module from ORM models, SQL scripts, or migration files. +Output: behavioral extraction docs under `04_generated_documentation/02_legacy_analysis/`. + +**Stage 3 — Screenshot and UX Mining:** +Build a screen inventory from screenshots or legacy templates alone, independent of code, cross-checking Stage 2's findings. Output under `04_generated_documentation/02_legacy_analysis/`. + +**Stage 4 — BRD vs Legacy Gap Analysis:** +Cross-reference `brd_inventory.md` (BRD-FR-xxx) against legacy analysis findings. For each BRD-FR, note: matched legacy behavior / partial match / no legacy precedent / legacy behavior contradicts BRD. Output under `04_generated_documentation/02_legacy_analysis/`. + +Rules: +- Distinguish confirmed legacy behavior, inferred behavior, proposed modernization, and new requirement. +- Flag ambiguity in `ambiguity_register.md` (`AMB-xxx`) instead of silently assuming. +- Do not invent business rules not evidenced in code, screenshots, or BRD. + +## Output expected + +Extraction and gap analysis files under `04_generated_documentation/02_legacy_analysis/`. + +## Exit criteria (QG-I, combined with Stage 0/1) + +Target requirements catalogued; legacy modules/APIs/DB/screens indexed; gap/conflict list produced. + +## Sample invocation + +> "Run up-legacy-gap-analysis on the legacy auth module and produce the gap analysis against brd_inventory.md." + +## Related skills + +Previous: `up-brd-extract` (Stage 1). Next: `up-use-case-author` (Stage 5). diff --git a/.agents/skills/up-parallel-work-integrate/SKILL.md b/.agents/skills/up-parallel-work-integrate/SKILL.md new file mode 100644 index 0000000..3beffaa --- /dev/null +++ b/.agents/skills/up-parallel-work-integrate/SKILL.md @@ -0,0 +1,189 @@ +--- +name: up-parallel-work-integrate +description: Integrate one or more named parallel-work branches, in argument order, into the currently checked-out master lane branch while preserving code, evidence, and governance integrity. Use after separate branches complete planned lanes and before integrated Gate 14.1 or another governing gate. Reconcile duplicate or divergent CR/DEF/AMB/DEC/TC/checkpoint/finding IDs semantically, rewrite references atomically, recompute current status from integrated evidence, and verify the combined runtime. Resumable: a paused integration is continued from its interim manifest, never restarted blind. Arguments are source branch names; the current branch is always the target. +--- + +# up-parallel-work-integrate — Cross-cutting branch integration + +## Objective + +Turn independently completed lane branches into one reviewable, verified master-lane result without treating Git's textual merge as governance reconciliation. Preserve each lane's product work and evidence, resolve shared-artifact conflicts by contract and source-of-truth rules, and canonicalize branch-local governance before a Gate can promote scope. + +Branch-local governance IDs and current-status summaries are provisional until this skill completes. This skill does not replace `up-traceability-gate`: integration establishes a coherent candidate tree; the gate decides whether stories are Delivered. + +## Parameters + +Invoke with one or more source branch names. Use two or more when all lanes +were developed away from the target; one source is valid when another lane +was implemented directly on the checked-out master lane: + +``` +/up-parallel-work-integrate [branch-2 ...] +``` + +- **Target:** the currently checked-out branch, called the master lane. +- **Sources:** branch arguments, integrated serially in the supplied order. +- Branch arguments may be local names or remote-tracking names such as `origin/lane-a`. +- Never infer branches from naming patterns, open pull requests, or recent commits. +- Never use the current branch as a source argument. + +## When to invoke + +- After one or more lanes in an approved `parallel_work_plan.md` have pushed complete branches and must converge with the master lane. +- Before Gate 14.1, release integration, or any status promotion based on combined lane evidence. +- To recover when lane branches independently edited governance registers and generated duplicate IDs or contradictory current summaries. +- To resume an integration that was deliberately paused mid-merge (context limit, handoff to another agent/session) — read its interim `integration_manifest.md` (`merge_state: in_progress`) rather than starting over. + +Do not invoke while a source lane is still changing, or while an earlier merge/rebase/cherry-pick is git-unresolved (conflict markers present). A cleanly paused integration recorded as `merge_state: in_progress` should be resumed once the target is checked out and clean, not treated as a blocker. Do not invoke when the intended target branch is not checked out. + +## Read first + +- Repository instructions (`AGENTS.md` and applicable nested instructions). +- Latest relevant checkpoint and its referenced registers. +- Current iteration's `parallel_work_plan.md`, `iteration_plan.md`, `iteration_backlog.md`, and `iteration_surface_matrix.md` when present. +- `00_process_control/change_request_register.md`, `defect_register.md`, `ambiguity_register.md`, `decision_log.md`, `traceability_graph.md`, and checkpoint index. +- Each source branch's required session transcript and lane verification/evidence summary. +- The governing requirements, architecture, contracts, and tests for files changed by more than one lane. + +## Safety Invariants + +- Do not push, force-push, rewrite source branches, amend commits, or alter remote history. +- Do not discard unrelated target or source changes. Never resolve a conflict using blanket `ours` or `theirs` across a file. +- Do not start from a dirty target worktree. A transcript created for the integration session is permitted only after its initial user request has been recorded; all other changes must be committed/stashed by their owner or explicitly dispositioned before integration. +- Integration requires durable merge commits. Before starting the first merge, obtain explicit user authorization to create the source merge commit(s) and one governance-reconciliation commit. If authorization is absent, stop after analysis/inventory and ask; do not enter a merge state. A skill invocation that explicitly asks to integrate/merge the named branches is sufficient commit authorization, but automatic skill matching or an analysis-only request is not. Never push unless explicitly requested. Preserve source histories with merge commits unless the repository's approved plan requires another strategy, and inspect each staged result before committing it. +- Do not allocate a canonical governance ID from filename order alone. Inspect the complete repository for the highest existing canonical ID and the semantic identity of each colliding entry. +- Do not promote stories, close a Gate, or overwrite authoritative current counts based only on branch-local evidence. +- Stop for human disposition when conflicts imply different requirements, architecture, scope, NFRs, or approved decisions. Invoke `up-change-request-impact` before changing the baseline. + +## Procedure + +### 1. Validate Invocation and Repository State + +1. Require at least one branch argument and reject duplicates. +2. Record the checked-out target branch and target HEAD. Confirm it is not one of the sources. +3. Confirm no merge, rebase, cherry-pick, or revert is in progress and the target is clean apart from the owned session transcript. +4. Check the active iteration directory for an existing `integration_manifest.md`. If one is present with `merge_state: in_progress` or `candidate_commit: pending`, this is a paused, not a failed, integration: read its recorded source order, captured SHAs, and already-created merge-commit SHAs, and resume from the next unmerged source instead of starting over. Never begin a second, overlapping integration attempt against the same target while one is already in progress. If the recorded state looks abandoned rather than paused (e.g. stale beyond this session's continuity, or the user disputes it), obtain explicit user disposition — resume or explicitly abandon/archive it — before superseding it. +5. Verify every source ref resolves to a commit. Fetch only when needed and permitted; do not pull or mutate branches. +6. Compute a merge base between the target and every source. Stop if histories are unrelated. +7. Read `parallel_work_plan.md` and compare supplied order with its approved merge order. If they differ, stop and request confirmation or correction. +8. Confirm explicit authorization for the required merge and governance-reconciliation commits. Without it, complete inventory only and stop before merging. +9. Capture target/source SHAs, merge bases, existing untracked files, and pre-integration test baseline in the session transcript. Resolve and merge the captured source SHAs, not movable branch names. + +### 2. Inventory Every Lane Before Merging + +For each source, inspect the full diff from its merge base and its commits. Build a lane inventory containing: + +- Product code, tests, migrations, configuration, contracts, and generated artifacts changed. +- Shared files changed by another source or the target. +- Governance entries added/changed: `CR-*`, `DEF-*`, `AMB-*`, `DEC-*`, `TC-*` test-case IDs, assumptions, risks, Gate findings, checkpoint IDs/files/index rows, traceability rows, current-status summaries, and artifact `last_cr`/version metadata. +- Lane evidence: commands, pass/fail/skip counts, runtime identifiers, unresolved blockers, and requirement-rooted findings. +- Missing transcript/evidence or edits outside the approved lane boundary. + +Classify overlaps before merge: + +- **Independent:** no shared contract or file. +- **Textual overlap:** same file, compatible intent. +- **Contract overlap:** API/schema/configuration/security behavior changed by multiple lanes. +- **Governance overlap:** IDs, dispositions, status summaries, or checkpoints overlap. +- **Baseline conflict:** incompatible requirements/architecture decisions; requires human/CR disposition. + +### 3. Establish the Canonical Governance Map + +Use the target-at-start as the canonical pre-integration baseline. For every branch-local entry, compare ID, title, trigger/root cause, owning requirement/story, affected artifacts, disposition, and evidence. + +Apply these rules: + +| Collision | Canonical action | +|---|---| +| Same ID, same meaning | Keep one ID; merge complementary chronology/evidence without duplicating claims. | +| Different IDs, same meaning | Keep the earliest valid canonical ID unless an approved reference dictates otherwise; collapse the duplicate. | +| Same ID, different meaning | Preserve the target's valid existing meaning; allocate the next unused canonical ID to the distinct source entry. | +| Different IDs, related but distinct | Keep both and add explicit cross-references; do not collapse root cause and symptom unless the governing skill says they are one record. | +| Conflicting dispositions | Follow explicit approved human decisions and authoritative integrated evidence; otherwise leave open and request disposition. | +| Conflicting current counts/status | Recompute from story-level integrated evidence; never choose one branch's summary wholesale. | +| Checkpoint collision | Allocate the next canonical `CKPT-NNN`, rename the file, update index and references; preserve each lane transcript as historical evidence. Handle either lane-side convention encountered: a full branch-local `checkpoint-NNN` file marked provisional (current `up-context-checkpoint` guidance), or an older lane-scoped stub file a lane kept outside the global sequence per its own `parallel_work_plan.md` — both resolve to one allocated canonical `CKPT-NNN`. | +| Gate finding ID collision (`G141-YYYYMMDD-NN`) | The date segment is a namespace, not a global counter: before assigning the next `NN`, search all sources plus the target for existing findings on that same date. A same-date collision from two sources gets the next unused `NN` for that date, never a reused one. | + +Prepare an old-to-canonical ID map per source before final governance edits. Search and update every semantic reference across registers, traceability, iteration artifacts, requirements/design metadata, tests/evidence documents, and checkpoints where a branch-local ID was intended as a durable repository reference. Session transcripts are append-only historical records: never rewrite prior entries; append a canonicalization note and mapping to the current integration transcript instead. + +When more than one distinct entry of the same ID type needs a new canonical ID, allocate in a deterministic order — by source-argument order, then by ascending branch-local ID within a source, then by commit chronology — so re-running this step from the same captured SHAs (for example, after a paused integration resumes) reproduces the identical mapping rather than a different one. + +### 4. Merge Sources Serially + +For each source in supplied order: + +1. Merge the captured source SHA with `--no-ff --no-commit` so even a fast-forward topology remains inspectable before any merge commit. +2. Resolve product conflicts using the approved contract, architecture, and smallest complete combined behavior. Preserve independent tests from both lanes. +3. Resolve governance files semantically using the canonical map, not line selection. +4. After conflicts are resolved and narrow checks pass, create the authorized non-interactive merge commit, then continue to the next source. Do not amend, squash, or push. +5. Run the narrowest relevant static/unit tests after each materially overlapping source. +6. If a source reveals an unapproved baseline conflict, stop. Preserve diagnostic state only if safe; otherwise abort the in-progress merge without changing pre-existing target work, record the blocker, and request disposition. +7. After each source's merge commit is created, write or update an interim `integration_manifest.md` with `merge_state: in_progress`, the sources merged so far and their merge-commit SHAs, and the sources still pending — before moving to the next source. If this session must pause before every source is merged (context limit, handoff to another agent or machine), invoke `up-context-checkpoint` recording the manifest's path and state, so a resuming session continues from the next unmerged source instead of re-merging or restarting. + +### 5. Reconcile the Integrated Governance State + +After all product changes are combined: + +1. Apply the complete canonical ID map atomically. +2. Preserve dated Gate snapshots and lane evidence as history. +3. Recompute candidate current story statuses and counts from approved deferrals and story-level evidence already available; label any status awaiting integrated verification as pending rather than authoritative. +4. Keep failed, skipped, or incompletely evidenced stories `PARTIAL`/Blocked; do not silently convert them to Deferred. +5. Preserve Deferred scope only when an approved `CR-*`/`DEC-*` supports it. +6. Update shared candidate current-status fields consistently across the traceability graph, surface matrix, iteration plan/backlog, work plan, registers, and checkpoint index. Do not commit yet and do not mark new scope Delivered here. +7. Update `integration_manifest.md` in the active iteration directory to `merge_state: complete`, superseding the interim per-source state from Step 4.7. Record target branch and starting SHA; ordered source names, captured SHAs, merge bases, and source merge commit SHAs; changed/shared artifacts; old-to-canonical governance ID map; conflict resolutions; planned verification commands; unresolved blockers; and `candidate_commit: pending`. This is the durable input to `up-traceability-gate` after finalization. + +### 6. Verify the Integrated Result + +Run, in order, against the fully merged and governance-reconciled candidate: + +1. Conflict-marker and repository-status checks. +2. Duplicate canonical governance-ID scan by register/artifact type. +3. Dangling-reference scan for every renumbered ID. +4. Current-status consistency check across authoritative summary artifacts. +5. Narrow tests for each lane and each conflict-resolved shared component. +6. Broader integrated regression/build/runtime/browser evidence required by `parallel_work_plan.md`. +7. If any required check fails, update the pending manifest with the failure, keep affected statuses non-Delivered, and do not create the reconciliation commit or invoke the Gate. Record the exact corrective next action. +8. If all required checks pass, finalize previously pending current statuses from the completed integrated evidence without promoting scope that still requires Gate 14.1. Update the manifest with commands/results and `gate_ready: true`; stage the canonical governance changes, manifest, and post-integration checkpoint together; inspect the staged diff; then create the authorized governance-reconciliation commit. +9. Resolve the resulting commit SHA, replace `candidate_commit: pending` with that SHA, set `manifest_finalized_for` to the same SHA, and create a small authorized manifest-finalization commit containing only `integration_manifest.md`. Record both SHAs. Gate verification must confirm current history contains both commits and that no product/governance files changed after the reconciliation commit except this manifest-only finalization commit and subsequent Gate outputs. +10. Invoke `up-traceability-gate` only after integrated evidence is authoritative, or report the exact blockers preventing it. + +Runtime evidence that uses shared host ports, fixed Compose projects, shared cloud fixtures, or destructive test identities must be serialized unless each lane has proven isolation. Integration on one master lane does not make concurrent runtime mutation safe. + +### 7. Report and Handoff + +Report: + +- Target branch and pre/post integration SHAs or worktree state. +- Source branches and SHAs, in merge order. +- Product conflicts and their semantic resolution. +- Governance collisions and the old-to-canonical ID map. +- Files changed and tests/evidence run. +- Gate result or exact reason Gate execution remains pending. +- Open human decisions, CRs, ambiguities, skipped evidence, and residual risks. + +## Output Expected + +- A coherent integrated worktree on the originally checked-out master lane branch. +- Canonical governance entries with no duplicate IDs or dangling rewritten references. +- Consistent current-status summaries derived from integrated evidence. +- Integrated verification results and a post-integration checkpoint. +- A durable active-iteration `integration_manifest.md` bound to the verified governance-reconciliation commit, auditable source merge commit(s), a canonical governance-reconciliation commit, and a manifest-finalization commit on the target; no push. + +## Exit Criteria + +- Every named branch and SHA was integrated or explicitly reported blocked. +- No unresolved merge marker, shared-contract conflict, duplicate canonical governance ID, dangling rewritten reference, or contradictory authoritative current status remains. +- Lane and cross-lane tests required by the plan pass, or failures are recorded without false promotion. +- Historical evidence and approved deferrals are preserved. +- The finalized manifest names the verified governance-reconciliation commit, and current history contains that commit with no subsequent product/governance change before Gate execution except its manifest-only finalization commit. +- Gate 14.1 or the applicable gate has run, or its exact blocking prerequisite is recorded as the next action. + +## Sample Invocations + +> `/up-parallel-work-integrate origin/lane-admin-governance origin/lane-account-settings` + +> "With `iteration-01-v2` checked out, integrate `developer-a/admin-governance` and `developer-b/account-settings` in that order. Treat their governance IDs as provisional, reconcile all references, rerun both isolated evidence lanes serially, and leave final delivery promotion to Gate 14.1." + +## Related Skills + +Consumes lanes planned by `up-iteration-plan` and implemented/repaired by `up-code-generate`, `up-defect-fix`, and `up-test-model-generate` (source of branch-local `TC-*` IDs). Invoke `up-change-request-impact` when integration exposes an unapproved requirements or architecture conflict. Feeds the coherent integrated result into `up-traceability-gate`, then `up-context-checkpoint` records the handoff — and should also be invoked mid-integration (Step 4.7) if a pause is needed before all sources are merged. diff --git a/.agents/skills/up-process-change/SKILL.md b/.agents/skills/up-process-change/SKILL.md new file mode 100644 index 0000000..b58a7ad --- /dev/null +++ b/.agents/skills/up-process-change/SKILL.md @@ -0,0 +1,75 @@ +--- +name: up-process-change +description: Apply a change to the process itself - a new stage, a new gate, a new document format, a new skill - through the same Change Request lifecycle used for product changes, producing a version bump (v1.1, v1.2, ...) and changelog entry in AI_Native_Unified_Process_v1.md instead of a new standalone document. Use this whenever someone proposes altering how the process works, not what the product does. Covers UP-AI v1.0 Meta-Governance (00_prompts/AI_Native_Unified_Process_v1.md §8.5). +--- + +# up-process-change — Cross-cutting meta-governance + +## Objective + +Ensure the process document governs its own evolution the same disciplined way it governs the product's requirements: any proposed change to stages, gates, formats, or skills is a `CR-xxx` with Trigger Type `Process-Adjustment`, impact-analyzed against *this document's sections* (not the product's traceability graph), approved, and landed as a version bump with a changelog entry. + +## When to invoke + +- Someone proposes a new stage, a new quality gate, a changed document format, a new skill, or a change to an existing skill's procedure. +- A retrospective (`up-iteration-plan`'s loop) or a UAT/handover lesson (`up-uat-handover`) surfaces a process problem, not a product one. +- Do NOT invoke for a one-off exception to the process on a single artifact — that's a normal `CR-xxx` via `up-change-request-impact`. + +## Read first + +- `00_prompts/AI_Native_Unified_Process_v1.md` (current version, especially Appendix A changelog) +- `04_generated_documentation/00_process_control/change_request_register.md` +- The relevant `.agents/skills/up-*/SKILL.md` file(s), if a skill itself needs to change + +## Procedure + +### Step 1 — Raise the CR + +Add a row to `change_request_register.md` with Trigger Type `Process-Adjustment`, Disposition "Proposed." Description states exactly what process behavior is being proposed and why. + +### Step 2 — Impact Analysis (against the process document, not the product graph) + +``` +A process change has been proposed: [CR-xxx description]. + +Read 00_prompts/AI_Native_Unified_Process_v1.md in full (or the +specific sections named) and report: +1. Which numbered sections/stages/gates would need to change. +2. Which .agents/skills/up-*/SKILL.md files would need to change. +3. Whether this changes the ID scheme (§2) or folder structure (§3). +4. Whether any in-flight work would be affected. + +Do not edit any document yet. +``` + +### Step 3 — Disposition (human checkpoint) + +Approve, defer, or reject. Process changes that alter the ID scheme or the traceability model warrant explicit human sign-off. + +### Step 4 — Apply and version-bump + +Update `00_prompts/AI_Native_Unified_Process_v1.md`: +- Apply the change to the affected section(s) only. +- Bump the document version (v1.1, v1.2, …) in the header table. +- Add a row to Appendix A (Version Changelog) citing the `CR-xxx`. +- Update any affected `.agents/skills/up-*/SKILL.md` file(s) to match. + +### Step 5 — Verify and close + +Confirm the updated process document and any updated skills are internally consistent. Mark the CR "Verified" then "Closed." + +## Output expected + +Updated `AI_Native_Unified_Process_v1.md` (version bumped, changelog updated); updated `.agents/skills/up-*/SKILL.md` file(s) where affected; closed `CR-xxx` entry. + +## Exit criteria + +Process document version bumped with a changelog entry; every skill file whose procedure or cross-references were affected is updated to match. + +## Sample invocation + +> "The iteration-02 retrospective flagged that 3-8 use cases per iteration is too large for infrastructure-only slices — propose a process change allowing smaller iterations for infrastructure-only slices, run Impact Analysis, and if approved, version-bump the process doc to v1.1." + +## Related skills + +Consumes the same lifecycle mechanics as `up-change-request-impact` but scoped to the process document and skills rather than the product's traceability graph. diff --git a/.agents/skills/up-project-bootstrap/SKILL.md b/.agents/skills/up-project-bootstrap/SKILL.md new file mode 100644 index 0000000..edb093d --- /dev/null +++ b/.agents/skills/up-project-bootstrap/SKILL.md @@ -0,0 +1,68 @@ +--- +name: up-project-bootstrap +description: Bootstrap the Inception-phase workspace, declarative tech profile (tech-profile.yaml), and governance files (master context, assumptions register, glossary, decision log, folder discovery report) for any Greenfield or Brownfield development program before deep source analysis begins. Use this at the very start of a new engagement, when 04_generated_documentation/00_process_control/ is empty or missing, or when re-establishing governance scaffolding after a reset. This is Stage 0 of the UP-AI v1.0 Generic Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-project-bootstrap — Stage 0 (Inception) + +## Objective + +Create a controlled workspace before deep source-code or requirements analysis happens, establishing the declarative technology profile (`tech-profile.yaml`) and core CMMI Level 3 governance registers so subsequent stages do not repeatedly re-consume unstructured directories. + +## When to invoke + +- Starting the process from scratch on a new Greenfield or Brownfield project. +- `04_generated_documentation/00_process_control/` is empty or missing. +- `tech-profile.yaml` needs to be initialized or re-baselined. + +## Parameters + +- `--archetype`: `greenfield` (0-to-1 build) | `brownfield` (legacy modernization/migration). Default: reads from `tech-profile.yaml` or prompts user. + +## Read first + +- `tech-profile.yaml` (if present) or `00_prompts/templates/tech-profile.template.yaml` +- `01_BRD/` or PRD inputs directory (folder and file names only) +- `02_legacy_source_code/` & `03_old_screenshots/` (Brownfield archetype only) +- `00_prompts/AI_Native_Unified_Process_v1.md` §4 "Stage 0" and §2 (ID scheme) + +## Procedure + +You are acting as a senior business analyst, solution architect, and CMMI Level 3 process consultant. + +Context & Scope Setup: +1. Check for `tech-profile.yaml` at project root. If missing, copy `00_prompts/templates/tech-profile.template.yaml` to `tech-profile.yaml` and configure it based on target project parameters. +2. Identify project archetype: + - **Greenfield Track:** Focuses on target PRD/BRD, target architecture, and domain modeling. Does not mandate legacy discovery. + - **Brownfield Track:** Inventories legacy codebases, database schemas, and screenshots as specified in `tech-profile.yaml`. + +Task — create, under `04_generated_documentation/00_process_control/`: +1. `master_context.md` — project goal, active archetype, target technology profile, integration sandboxes, and active stage/iteration index. +2. `assumptions_register.md` — initialize with standard `ASM-xxx` table schema (`ID | Date | Stage | Assumption | Basis | Risk Level | Status | Superseded By`). +3. `vocabulary_glossary.md` — seed with domain terminology extracted from high-level documents. +4. `decision_log.md` — initialize with standard `DEC-xxx` table schema (`ID | Date | Stage | Decision | Rationale | Alternatives Considered | Impact | Made By`). +5. `folder_discovery_report.md` — inventory of project input folders (file names, purpose, risk notes) and recommended processing sequence. + +Rules: +- Do not deeply analyze source code or PRD content yet — that starts at Stage 1. +- Do not invent detailed business rules. +- Capture only known facts, assumptions, risks, and open questions. +- If `assumptions_register.md` / `decision_log.md` already exist with entries, do not overwrite — validate schema and append. +- Every ID minted anywhere in this process follows the scheme in `00_prompts/AI_Native_Unified_Process_v1.md` §2. +- Keep output concise, structured, and markdown formatted. + +## Output expected + +`tech-profile.yaml`, `00_process_control/master_context.md`, `assumptions_register.md`, `vocabulary_glossary.md`, `decision_log.md`, `folder_discovery_report.md`. + +## Exit criteria + +`tech-profile.yaml` is configured; folder structure exists; governance files are initialized; recommended processing order for Stage 1 is documented. + +## Sample invocation + +> "/up-project-bootstrap --archetype greenfield" + +## Related skills + +Next: `up-brd-extract` (Stage 1). If Brownfield: `up-legacy-gap-analysis` (Stages 2–4). diff --git a/.agents/skills/up-srs-derive/SKILL.md b/.agents/skills/up-srs-derive/SKILL.md new file mode 100644 index 0000000..e4172ba --- /dev/null +++ b/.agents/skills/up-srs-derive/SKILL.md @@ -0,0 +1,54 @@ +--- +name: up-srs-derive +description: Derive system requirements (NFRs, screen-to-system mapping, API/data/integration/validation/audit requirement formats) from the gated functional-requirement set, with every SRS/NFR item explicitly declaring the FR-xxx it derives from. Use this after the architecture spike (up-arch-risk-spike) has validated the highest-risk architecture, and before full HLD/LLD fan-out. This is Stage 8 (Elaboration) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-srs-derive — Stage 8 (Elaboration) + +## Objective + +Derive SRS/NFR requirements from the use-case-owned functional requirements, using standard field-level formats (screen-to-system mapping, API requirement format, data requirement format, integration requirement format, validation and error-handling format, audit requirement format, non-functional requirement format), with a mandatory `parent_fr` link. + +## When to invoke + +- After `up-arch-risk-spike` (Stages 6–7) has produced a validated architecture baseline and service template. +- When a `CR-xxx` re-baseline requires re-deriving SRS/NFR for a specific set of affected FRs (scope the run to just those FR-xxx, per the CR's Impact Analysis). + +## Read first + +- `04_generated_documentation/03_requirements/use_cases/` (all FR-xxx, with parent_uc) +- `architecture_spike_report.md` +- `00_prompts/AI_Native_Unified_Process_v1.md` §5 "Stage 8" + +## Procedure + +For every `FR-xxx` in scope, derive the applicable system requirements using the standard field formats: +- Screen-to-system mapping (where the FR involves a UI screen) +- API requirement format (endpoint-level requirements) +- Data requirement format (entities, fields, constraints) +- Integration requirement format (trigger, data sent, data received, failure expectation) +- Validation and error-handling format +- Audit requirement format +- Non-functional requirement format (performance, security, scalability, availability — cross-cutting, may apply across multiple FRs) + +Mandatory field: every `SRS-xxx`/`NFR-xxx` record must declare `parent_fr: FR-xxx` explicitly. An SRS/NFR requirement with no `parent_fr` is not a valid output (cross-cutting NFRs may declare multiple `parent_fr` values, or `parent_fr: cross-cutting` with an explicit scope note — but never omit the field). + +Rules: +- Do not invent NFRs not implied by an FR, a BRD constraint, or an explicit architectural decision (`DEC-xxx`) from the Stage 7 spike. +- Where an FR's screen/data/integration needs are ambiguous, log `AMB-xxx` rather than guessing a format value. + +## Output expected + +`04_generated_documentation/03_requirements/SRS-xxx_*.md` (or scoped per-FR SRS sections within the use case's own folder), each declaring `parent_fr`. + +## Exit criteria + +Every FR in scope has at least one derived SRS/NFR requirement declaring its parent FR. This is checked by `up-traceability-gate` (Gate 9.1) together with HLD/LLD linkage. + +## Sample invocation + +> "Run up-srs-derive for all FR-xxx under UC-001 (User Identity and Role Governance) — apply the integration requirement format for the Identity Provider / OIDC touchpoints specifically." + +## Related skills + +Previous: `up-arch-risk-spike` (Stage 7). Next: `up-hld-lld-generate` (Stage 9), then `up-traceability-gate` (Gate 9.1). diff --git a/.agents/skills/up-test-model-generate/SKILL.md b/.agents/skills/up-test-model-generate/SKILL.md new file mode 100644 index 0000000..2fe40b3 --- /dev/null +++ b/.agents/skills/up-test-model-generate/SKILL.md @@ -0,0 +1,62 @@ +--- +name: up-test-model-generate +description: Generate functional, unit, API/contract, browser-E2E, smoke, and usability test cases for the current iteration's stories, maintain Bruno API collections and a reproducible, tagged regression suite runnable at multiple scopes (project/iteration/UC/FR), compile the 21-sheet Manual QA Excel workbook, and produce the iteration's Manual Testing Guide for QA. Use this after up-iteration-plan has selected the iteration's use-case slice, and before or alongside up-code-generate. Covers Stage 12 (Construction) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-test-model-generate — Stage 12 (Construction, per iteration) + +## Objective + +Generate comprehensive multi-path test cases scoped to the current iteration's stories, compiling the 21-sheet Manual QA Excel Workbook (`.xlsx`) and Markdown Guide, maintaining git-versioned Bruno collections, and folding tests into the cumulative regression suite to guarantee ≥95% automated test coverage. + +## When to invoke + +- After `up-iteration-plan` has produced `iteration_backlog.md`. +- Can run in parallel with `up-wireframe-spec`. +- Also invoke whenever `up-defect-fix` adds a regression test for a fixed defect. + +## Read first + +- `tech-profile.yaml` (identifies test frameworks, coverage thresholds, and sandboxes) +- Current iteration's `04_generated_documentation/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md` (STORY-xxx list) +- `04_generated_documentation/03_requirements/use_cases/uc-xxx_*/functional-reqs.md` (acceptance criteria per FR) +- `04_generated_documentation/07_test_design/regression_test_cases.md` (traceability index of the cumulative regression suite) +- `04_generated_documentation/07_test_design/test_strategy.md` (tagging convention, tool-per-test-type) +- Current iteration's `iteration_surface_matrix.md` +- Current iteration's `parallel_work_plan.md`, if parallel lanes are planned + +## Procedure + +For every `STORY-xxx` in the current iteration: +1. Derive one or more `TC-xxx` test cases directly from its FR's acceptance criteria. +2. Cover main flow, alternate flows, and exception flows as authored in the owning use case. +3. Add the new `TC-xxx` set to the appropriate `04_generated_documentation/07_test_design/functional_test_cases/TC-0xx_*.md` file. +4. Fold tests that should run on every future build into `regression_test_cases.md` — tag with originating iteration. +5. Update `test_traceability_matrix.md` so each `TC-xxx` traces back to its `STORY-xxx` → `FR-xxx` → `UC-xxx`. + +**Per-type applicability:** For every `STORY-xxx`, record an explicit decision for Unit, Smoke, and Usability — `Required` (with derived `TC-xxx`) or `N/A` (with stated reason). + +**Bruno API collections:** For every API surface touched by the iteration, generate/update a Bruno collection (`.bru`, git-versioned plain text) under `docs/api/bruno//` in the implementation workspace, derived from OpenAPI specs. + +**Regression suite index:** Index runnable tests in `regression_test_cases.md` (`TC-xxx | test_level | automation status | physical file path/collection path | tags`). Tag every automated test so `scripts/run_tests.sh` can select it by scope (`--scope project|iteration-NN|uc-xxx|fr-xxx`). + +**Manual Testing Guide & 21-Sheet Excel Workbook:** For every iteration, Stage 12 MUST produce TWO complementary manual QA deliverables: +1. Markdown walkthrough guide: `04_generated_documentation/07_test_design/manual_qa/iteration-NN/MANUAL_TESTING_GUIDE.md` (preconditions, steps, disposable personas, expected results). +2. 21-sheet, 30-column Excel Manual QA Workbook: `04_generated_documentation/07_test_design/manual_qa/workbooks/IterationNN__Complete_Manual_Testcases.xlsx`, compiled deterministically using `scripts/generate_manual_qa_workbook.py`. + +**Test Idempotency & Disposable Personas:** Automated browser (Playwright) and API tests MUST enforce test idempotency — tests MUST NOT mutate shared global records. Use disposable personas or isolated database fixtures. + +**Multi-Path Test Coverage & Density:** Every user story MUST be modeled across four test dimensions: (1) Happy Path, (2) Alternate & Boundary/Edge Cases, (3) Negative & Failure Paths, and (4) FSM Invariant & Concurrency Checks. Target the coverage budgets configured in `tech-profile.yaml` (e.g. **≥95.0%** for domain FSMs, **≥90.0%** for adapters, **≥80.0%** for frontend components + Playwright E2E). + +## Output expected + +Updated `04_generated_documentation/07_test_design/functional_test_cases/TC-0xx_*.md`, `regression_test_cases.md`, `test_traceability_matrix.md`, `iteration_surface_matrix.md`; Bruno collections; `MANUAL_TESTING_GUIDE.md` AND 21-sheet Manual QA Workbook `.xlsx`. + +## Exit criteria + +Every story in the iteration has ≥1 test case; every story has an explicit Unit/Smoke/Usability applicability decision; every applicable delivery surface has an appropriate test type; every in-scope web portal/screen has browser-E2E coverage; regression suite index is updated; this iteration's required QA deliverables (Manual Testing Guide and/or 21-sheet Manual QA Workbook) exist; multi-path coverage achieves configured targets. + +## Related skills + + +Previous: `up-iteration-plan` (Stage 10). Parallel: `up-wireframe-spec`. Feeds: `up-traceability-gate` (Gate 14.1), `up-code-generate`/`up-defect-fix`. diff --git a/.agents/skills/up-traceability-gate/SKILL.md b/.agents/skills/up-traceability-gate/SKILL.md new file mode 100644 index 0000000..ea3e848 --- /dev/null +++ b/.agents/skills/up-traceability-gate/SKILL.md @@ -0,0 +1,94 @@ +--- +name: up-traceability-gate +description: Run the enforced traceability completeness check against the single traceability graph and the iteration delivery-surface matrix — scanning for use cases with zero requirements, requirements with no owning use case, requirements with no SRS/HLD/LLD linkage, unimplemented frontend/API/data/integration surfaces, or iterations that closed with undelivered scope. Use this at the end of Stage 5, Stage 9, every Construction iteration, before any baseline/sign-off, and any time drift is suspected. Covers Gates 5.1, 9.1, and 14.1 of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-traceability-gate — Gates 5.1 / 9.1 / 14.1 (cross-cutting) + +## Objective + +Make traceability completeness a mandatory, executable checkpoint at every stage boundary touching requirements, architecture, or delivery. Progress is strictly blocked if any story or delivery surface lacks specification or test evidence. + +There is exactly **one** traceability graph — `04_generated_documentation/00_process_control/traceability_graph.md` — this skill is the only thing that writes to it. Never hand-edit it directly. + +## When to invoke + +Three mandatory checkpoints, plus ad hoc use: + +1. **Gate 5.1** — after any `up-use-case-author` run (or batch of runs), before proceeding to `up-arch-risk-spike` (Stage 6). +2. **Gate 9.1** — after `up-srs-derive` (Stage 8) and `up-hld-lld-generate` (Stage 9), before proceeding to Construction (`up-iteration-plan`, Stage 10). +3. **Gate 14.1** — at the end of every Construction iteration, before marking any `FR-xxx` as "Delivered" and before starting the next iteration or entering Transition. +4. **Ad hoc** — any time graph drift is suspected. + +## Read first + +- `tech-profile.yaml` (identifies coverage thresholds, auth claims, and sandboxes) +- `04_generated_documentation/03_requirements/use_cases/` (all UC + FR files) +- `04_generated_documentation/03_requirements/` SRS/NFR outputs (Stage 8) +- `04_generated_documentation/04_architecture_design/` HLD/LLD outputs (Stage 9) +- Current iteration's `04_generated_documentation/05_iteration_planning/iterations/iteration-NN/` (Gate 14.1 only) +- Current iteration's `iteration_surface_matrix.md` (Gate 14.1 only) +- `04_generated_documentation/07_test_design/regression_test_cases.md` (Gate 14.1 only — regression-suite health check) +- Current iteration's `parallel_work_plan.md`, if present (Gate 14.1 only), plus `integration_manifest.md` produced by `up-parallel-work-integrate` when named branches were used +- `04_generated_documentation/00_process_control/traceability_graph.md` (previous state, if any) +- `00_prompts/AI_Native_Unified_Process_v1.md` §9 (Quality Gates) + +## Procedure + +### Step 0 — Automated Deterministic Validation +Before manual or semantic evaluation, run the deterministic gate validator script: +```bash +python3 scripts/verify_traceability_gates.py --gate <5.1|9.1|14.1> [--iteration iteration-NN] +``` +If the script exits with non-zero (Critical issues detected), STOP and resolve them immediately before performing further reviews. + +### Gate 5.1 — UC ↔ FR Completeness + +1. Execute `python3 scripts/verify_traceability_gates.py --gate 5.1`. +2. Inspect every file under `04_generated_documentation/03_requirements/use_cases/`. For each `UC-xxx`, confirm at least one `FR-xxx` declares `parent_uc = UC-xxx`. For every `FR-xxx` found anywhere in the tree, confirm its `parent_uc` resolves to an existing `UC-xxx` file. + +Produce a table: `Check-ID | UC or FR | Issue | Severity (Critical/Major/Minor) | Required Action`. + +FAIL (do not proceed) if any Critical issue exists: +- Critical: a `UC-xxx` with zero `FR-xxx` children. +- Critical: an `FR-xxx` with a `parent_uc` that does not exist. +- Major: an `FR-xxx` with `source_brd_fr = "new — not in BRD"` and no business justification cited. + +### Gate 9.1 — FR ↔ SRS ↔ HLD ↔ LLD Completeness + +1. Execute `python3 scripts/verify_traceability_gates.py --gate 9.1`. +2. Scan every `FR-xxx` and confirm each resolves to: at least one SRS/NFR requirement, at least one HLD component, and at least one LLD artifact (API, table, or event). Same table format. FAIL if any FR has no SRS linkage, no HLD component, or no LLD artifact. + +### Gate 14.1 — Iteration Definition of Done + +1. Execute `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-NN`. +2. For the current iteration, confirm for every `STORY-xxx`: + 1. Requirement mapped across all applicable delivery surfaces in `iteration_surface_matrix.md`. + 2. API documented; database migration present; integration adapter verified. + 3. Tests passing: unit + API integration + real-runtime tests. + 4. Browser-E2E evidence for all web portals/views in scope. + 5. Explicit Unit/Smoke/Usability applicability decisions recorded. + 6. Required QA deliverables exist per project tailoring tier (e.g. `MANUAL_TESTING_GUIDE.md` and/or 21-sheet `IterationNN__Complete_Manual_Testcases.xlsx`). + 7. Multi-path automated code and branch coverage meets or exceeds configured tier budgets (e.g. **≥95.0%** for domain FSMs, **≥90.0%** for adapters, **≥80.0%** for frontend components). + 8. Cumulative regression suite passes via `scripts/run_tests.sh --scope iteration-NN`. + +FAIL if any story lacks passing tests, automated test coverage does not meet configured thresholds, regression tests fail, QA workbooks/guides are missing, or delivery surfaces are unowned. On pass, mark every associated `FR-xxx` as "Delivered" in the graph. + + +## Output expected + +Updated `04_generated_documentation/00_process_control/traceability_graph.md` with a dated Gate-check section; blocking issue table if findings exist. + +## Exit criteria + +Zero Critical issues for the gate being run. + +## Sample invocation + +> "Run up-traceability-gate (Gate 5.1) across all use cases authored so far in 04_generated_documentation/03_requirements/use_cases/." + +> "Run up-traceability-gate (Gate 14.1) for iteration-01." + +## Related skills + +Feeds from: `up-use-case-author`, `up-srs-derive`, `up-hld-lld-generate`, `up-code-generate`/`up-defect-fix`, and `up-parallel-work-integrate`. Feeds into: `up-arch-risk-spike`, `up-iteration-plan`, `up-uat-handover`. diff --git a/.agents/skills/up-uat-handover/SKILL.md b/.agents/skills/up-uat-handover/SKILL.md new file mode 100644 index 0000000..347138b --- /dev/null +++ b/.agents/skills/up-uat-handover/SKILL.md @@ -0,0 +1,54 @@ +--- +name: up-uat-handover +description: Prepare DevOps/CI-CD, UAT release packaging, client handover, and the final review-ready baseline once Construction has delivered the full release scope. Use this once the traceability graph shows the release's use-case scope is 100% Delivered (or explicitly Deferred via an approved CR). Covers Stages 15-18 (Transition) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-uat-handover — Stages 15–18 (Transition) + +## Objective + +Deploy, validate through UAT, hand over to the client, and produce the final baseline/sign-off package — gated on the traceability graph showing complete, verified delivery. + +## When to invoke + +- Once Construction's iteration loop has delivered the full use-case scope for the current release (checked via `up-traceability-gate`), or the remaining gaps are explicitly Deferred via approved `CR-xxx`. +- Do not invoke while iterations are still in flight for in-scope use cases — finish the loop first. + +## Read first + +- `04_generated_documentation/00_process_control/traceability_graph.md` (confirm 100% Delivered-or-Deferred-with-CR for release scope) +- `04_generated_documentation/05_iteration_planning/iterations/` (all completed iterations) +- `04_generated_documentation/07_test_design/regression_test_cases.md` (cumulative suite) +- `00_prompts/AI_Native_Unified_Process_v1.md` §7 "Stages 15–18" + +## Procedure + +**Stage 15 — DevOps and CI/CD:** finalize deployment pipelines, container builds, environment configuration for the services delivered across all iterations. + +**Stage 16 — UAT Release Preparation:** package the release for UAT — release notes traced to delivered `FR-xxx`/`UC-xxx`, known-issues list, regression suite execution results (`scripts/run_tests.sh --scope project`), production-readiness checklist against the Minimum Definition of Done. + +**Stage 17 — Client Handover:** prepare the handover package — source code, deployment instructions, API documentation, operational runbooks, open-issues register. + +**Stage 18 — Baseline and Sign-off:** produce `04_generated_documentation/08_review_ready_baselines/` (baseline requirements, HLD, LLD, test plans, traceability matrix, open issues register, stakeholder review checklist). Assert the traceability graph shows no orphan or undelivered FR without an approved deferral CR before calling this a baseline. + +Rules: +- Do not mark UAT-ready if any Critical `up-traceability-gate` finding is still open. +- Any defect found during UAT that is requirements-rooted goes through `up-change-request-impact`. + +## Output expected + +Deployment/CI-CD configuration; UAT release package; client handover package; `04_generated_documentation/08_review_ready_baselines/*`. + +## Exit criteria (QG-T) + +UAT passed; production readiness checklist passed; traceability graph shows 100% of in-scope FRs Delivered-and-Tested or explicitly Deferred via an approved `CR-xxx`. + +## Sample invocation + +> "All planned iterations for the MVP release scope show Delivered in the traceability graph — run up-uat-handover to prepare the UAT release package and baseline in 08_review_ready_baselines/." + +> "UAT found a defect in the payment gateway webhook integration — raise a CR via up-change-request-impact first if it's requirements-rooted, then re-run up-uat-handover once it's resolved." + +## Related skills + +Previous: the full Construction loop (`up-iteration-plan` → … → `up-traceability-gate`, repeated). If a UAT finding is requirements-rooted: `up-change-request-impact`. diff --git a/.agents/skills/up-use-case-author/SKILL.md b/.agents/skills/up-use-case-author/SKILL.md new file mode 100644 index 0000000..974943f --- /dev/null +++ b/.agents/skills/up-use-case-author/SKILL.md @@ -0,0 +1,53 @@ +--- +name: up-use-case-author +description: Author ONE use case as a single, self-contained requirements artifact — narrative plus its embedded child functional requirements (FR-xxx). Use this whenever a new use case needs to be documented or an existing use case needs its functional requirements filled in. This is Stage 5 (Elaboration) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-use-case-author — Stage 5 (Elaboration) + +## Objective + +Author each use case as the single, atomic, requirements-owning artifact — functional requirements are children of the use case, authored together with it, not a separate document reconciled after the fact. + +## When to invoke + +- Authoring a brand-new use case from Inception-phase inputs. +- Filling in functional requirements for a use case that currently has narrative only. +- Never invoke to author FRs in isolation from a use case — if you find yourself writing a functional requirement with no parent use case in view, stop and identify or create the owning use case first. + +## Read first + +- `04_generated_documentation/01_source_inventories/brd_inventory.md` (BRD-FR-xxx) +- Relevant `04_generated_documentation/02_legacy_analysis/` files (if Brownfield) +- `00_prompts/AI_Native_Unified_Process_v1.md` §5 "Stage 5" + +## Procedure + +You are authoring ONE use case as a single, self-contained requirements artifact. Do not treat functional requirements as a separate document to be reconciled later — they are children of this use case and are authored here, now, together. + +For use case `UC-xxx` (``): +1. Write the use case narrative: actors, preconditions, trigger, main success flow, alternate flows, exception flows, postconditions. +2. Immediately below, list every functional requirement this use case creates. Each `FR-xxx` MUST declare: + - `parent_uc: UC-xxx` (this use case, always) + - `source_brd_fr`: one or more `BRD-FR-xxx` IDs, or `"new — not in BRD"` + - statement, priority (Must/Should/Could), acceptance criteria + - referenced screen(s) / routes + - business rules invoked +3. If any part of this use case cannot be resolved from the inputs, record it as `AMB-xxx` in `ambiguity_register.md` — do not silently invent behavior. +4. A use case with zero `FR-xxx` children is not a valid output. If you cannot identify at least one functional requirement, flag the use case itself as ambiguous rather than emitting an empty shell. + +## Output expected + +`04_generated_documentation/03_requirements/use_cases/uc-xxx_/use-case.md` and `functional-reqs.md`, each carrying front-matter `id`, `version`, `status`. + +## Exit criteria + +Do not consider a use case done until `up-traceability-gate` (Gate 5.1) passes for it — i.e., it has ≥1 `FR-xxx` child, and every `FR-xxx` resolves to a real `UC-xxx`. + +## Sample invocation + +> "Run up-use-case-author for UC-001 (User Identity and Role Governance), using brd_inventory.md as input. Embed the FR-xxx children directly under 04_generated_documentation/03_requirements/use_cases/uc-001_user-identity/." + +## Related skills + +Previous: `up-brd-extract` (Stage 1) or `up-legacy-gap-analysis` (Stages 2-4). Next: `up-traceability-gate` (Gate 5.1), once Gate 5.1 passes across the full use-case set in scope. diff --git a/.agents/skills/up-wireframe-spec/SKILL.md b/.agents/skills/up-wireframe-spec/SKILL.md new file mode 100644 index 0000000..49a1279 --- /dev/null +++ b/.agents/skills/up-wireframe-spec/SKILL.md @@ -0,0 +1,49 @@ +--- +name: up-wireframe-spec +description: Generate wireframes and field-level screen specifications for the use cases in the current iteration's slice, while mapping every portal/screen/route to an accountable frontend implementation and browser-QA task. Use this after up-iteration-plan has selected the iteration's use-case slice. This is Stage 11 (Construction) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md). +--- + +# up-wireframe-spec — Stage 11 (Construction, per iteration) + +## Objective + +Produce wireframes and field-level screen specifications for the views/screens touched by the current iteration's use cases — scoped to the active iteration's vertical slice. + +## When to invoke + +- After `up-iteration-plan` has produced `iteration_backlog.md` for the current iteration. +- Can run in parallel with `up-test-model-generate`. + +## Read first + +- `tech-profile.yaml` (identifies frontend framework, UI libraries, design tokens path, and auth provider) +- Current iteration's `04_generated_documentation/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md` +- `04_generated_documentation/03_requirements/use_cases/uc-xxx_*/functional-reqs.md` (referenced screens/fields per FR) +- `04_generated_documentation/06_wireframes/wireframe_index.md` (existing index, if any) +- `04_generated_documentation/06_wireframes/DESIGN.md` (screen-archetype, shared-pattern, and API-binding conventions) +- Current iteration's `iteration_surface_matrix.md` + +## Procedure + +For every `UC-xxx` in the current iteration's backlog: +1. Enumerate the screens/views referenced by its `FR-xxx` children (`referenced screens` field). +2. For each screen, identify its archetype and check for applicable shared patterns in `DESIGN.md` before designing custom layouts. Produce a wireframe-level layout description (regions, key controls, state guards) and a field-level specification (field name, type, validation, source FR, backend processing expectation). +3. Update `wireframe_index.md` to include the new screens, tagged to their owning `UC-xxx`/`FR-xxx` and iteration number. +4. Reconcile every referenced screen, route, and actor-specific flow against `iteration_surface_matrix.md`; assign frontend implementation and browser-QA ownership. + +Rules: +- Do not wireframe screens outside the current iteration's use-case scope. +- Flag any field/validation ambiguity as `AMB-xxx` rather than guessing. +- Every screen specification MUST explicitly declare its Client Application ID, exact Frontend Route / Path, and required Authorization Role/Scope claims per `DESIGN.md` and `tech-profile.yaml`. + +## Output expected + +Portal/screen wireframe specs under `04_generated_documentation/06_wireframes/`; updated `wireframe_index.md`; reconciled `iteration_surface_matrix.md`. + +## Exit criteria + +Every screen referenced by an in-scope FR has a wireframe and field-level spec, plus frontend and browser-QA owners in `iteration_surface_matrix.md`, before `up-code-generate` begins frontend work. + +## Related skills + +Previous: `up-iteration-plan` (Stage 10). Parallel: `up-test-model-generate`. Next: `up-code-generate` (Stage 13). diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa3cc85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +# Implementation Workspace (kept separate from process branch) +05_implementation_workspace/ + +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +.pytest_cache/ +.coverage +htmlcov/ +.venv/ +venv/ +ENV/ + +# Node / Frontend +node_modules/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* +dist/ +build/ +.next/ +out/ + +# IDE & OS +.idea/ +.vscode/ +*.swp +*.swo +*~ +.DS_Store +Thumbs.db diff --git a/00_prompts/02_Skills_Usage_Guide.md b/00_prompts/02_Skills_Usage_Guide.md new file mode 100644 index 0000000..52cad34 --- /dev/null +++ b/00_prompts/02_Skills_Usage_Guide.md @@ -0,0 +1,246 @@ +# Skills Usage Guide — Invoking UP-AI v1.1 (Universal Generic Edition) + +**Purpose:** The 18 skills under `.agents/skills/` are the canonical executable forms of `00_prompts/AI_Native_Unified_Process_v1.md`. This guide shows, stage by stage, which skill to invoke and how across both **Greenfield (0-to-1)** and **Brownfield (Modernization)** projects. + + +## How to Invoke a Skill + +1. **Explicit, slash-style** — name the skill directly: `/up-use-case-author UC-001 user-identity-and-role-governance`. +2. **Sub-Agent / Role-based** — invoke with specialized persona prefix: + - `@requirements-analyst /up-brd-extract` + - `@spike-architect /up-arch-risk-spike` + - `@ui-designer-dev /up-wireframe-spec` + - `@backend-dev /up-code-generate` + - `@adversarial-tester /up-test-model-generate` + - `@gatekeeper /up-traceability-gate 14.1` +3. **Natural language** — describe the task; AI agents match it to the skill by its `description` frontmatter. + +--- + +## 1. Inception (Stages 0–4) — Dual-Track Execution + +### Greenfield Track (0-to-1 Development) +| Stage | Skill | Action | +|---|---|---| +| 0 | `up-project-bootstrap` | Initialize workspace with `tech-profile.yaml` configured as `archetype: greenfield` | +| 1 | `up-brd-extract` | Extract business features and requirements from PRD/BRD, mint `BRD-FR-xxx` IDs | +| 1B / 6 | `up-arch-risk-spike` | Score domain risks, build thin walking skeleton before use-case authoring | + +**Greenfield Invocations:** +```bash +# Stage 0: Bootstrap greenfield workspace with declarative profile +/up-project-bootstrap --archetype greenfield + +# Stage 1: Extract PRD features +/up-brd-extract 01_BRD/PRD_Specification.md +``` + +### Brownfield Track (Legacy Modernization / Migration) +| Stage | Skill | Action | +|---|---|---| +| 0 | `up-project-bootstrap` | Initialize workspace with `tech-profile.yaml` configured as `archetype: brownfield` | +| 1 | `up-brd-extract` | Extract target business requirements from BRD | +| 2–4 | `up-legacy-gap-analysis` | Mine legacy AST source code, DB schema, and UI screenshots into `02_legacy_analysis/` | + +**Brownfield Invocations:** +```bash +# Stage 0: Bootstrap brownfield workspace +/up-project-bootstrap --archetype brownfield + +# Stage 2-4: Run legacy gap analysis on a target module +/up-legacy-gap-analysis LegacyApp user-management +``` + +--- + +## 2. Elaboration (Stages 5–9) — Architecture & Requirements Spine + +Invocation sequence: **Author (UC+FR) → Gate 5.1 → Risk Spike (Walking Skeleton) → SRS Derivation → HLD/LLD Fan-out → Gate 9.1** + +| Stage | Skill | Gate after? | +|---|---|---| +| 5 | `up-use-case-author` | → Gate 5.1 (`up-traceability-gate`) | +| 6–7 | `up-arch-risk-spike` | — | +| 8 | `up-srs-derive` | — | +| 9 | `up-hld-lld-generate` | → Gate 9.1 (`up-traceability-gate`) | + +**Stage 5 — Author a Use Case (repeat per use case in scope):** +```bash +/up-use-case-author UC-001 user-identity-and-role-governance +``` +> "@requirements-analyst Author UC-001, User Identity and Role Governance. Embed the functional requirements (FR-AUTH-001 through FR-AUTH-003) directly under the use case." + +**Immediately run Gate 5.1 — do not skip even if the use case looks complete:** +```bash +# Deterministic CLI check: +python3 scripts/verify_traceability_gates.py --gate 5.1 + +# Or via agent skill: +/up-traceability-gate 5.1 +``` +> "@gatekeeper Run the Gate 5.1 traceability check across everything authored under 04_generated_documentation/03_requirements/use_cases/." + +*If Critical findings exist (e.g., orphan FR or UC with 0 FRs), resolve before proceeding.* + +**Stage 6–7 — Rank Architectural Risk and Build Walking Skeleton Spike:** +```bash +/up-arch-risk-spike +``` +> "@spike-architect Score every authored use case for architectural risk (data isolation, third-party auth/payment gateways, high concurrency, financial sensitivity). Validate the top 15-20% significant shortlist with a thin walking skeleton HLD/LLD." + +**Stage 8 — Derive System Requirements (SRS / NFRs):** +```bash +/up-srs-derive UC-001 +``` +> "Derive SRS and NFR requirements for all FRs under UC-001. Every SRS/NFR item must declare its parent_fr." + +**Stage 9 — Fan out HLD/LLD Design using the Validated Spike Template:** +```bash +/up-hld-lld-generate +``` +> "Design HLD and LLD in 04_architecture_design/ for the remaining use cases using the validated service template from architecture_spike_report.md." + +**Gate 9.1 — Pre-Construction Architecture Gate:** +```bash +# Deterministic CLI check: +python3 scripts/verify_traceability_gates.py --gate 9.1 + +# Or via agent skill: +/up-traceability-gate 9.1 +``` +> "Run the Gate 9.1 check — confirm every FR resolves to an SRS requirement, an HLD component, and an LLD artifact before starting Construction." + + +--- + +## 3. Construction (Stages 10–14) — The Iteration Delivery Loop + +Each iteration delivers a vertical slice of 3–8 related use cases to working software. + +**Stage 10 — Iteration Planning & Surface Matrix:** +```bash +/up-iteration-plan +``` +> "Plan iteration-01 in 05_iteration_planning/iterations/iteration-01/. Generate iteration_backlog.md and iteration_surface_matrix.md covering API, Frontend, Database, Integration, and QA surfaces." + +**Stages 11 & 12 — Screen Specs & Multi-Path Test Model (Run in Parallel):** +```bash +/up-wireframe-spec +/up-test-model-generate +``` +> "@ui-designer-dev Produce wireframes and field specs under 06_wireframes/ for iteration-01's screens, applying DESIGN.md tokens." +> "@adversarial-tester Generate multi-path test cases in 07_test_design/ (Happy, Alternate/Boundary, Negative, FSM Invariants), update Bruno API collections, and compile the 21-sheet Manual QA Excel Workbook (.xlsx)." + +**Stage 13 — Wave-Based Code Generation ($\ge 95\%$ Coverage):** +```bash +/up-code-generate STORY-AUTH-001 +``` +> "@backend-dev @ui-designer-dev Implement STORY-AUTH-001 (User Registration & OIDC Login) against LLD-001 and screen specs. Generate backend routes, DB migrations, frontend views, and unit/integration/E2E tests achieving ≥95.0% coverage." + +**Stage 14 — Code Review, Defect Triage & Gate 14.1:** +```bash +/up-defect-fix DEF-001 +``` +> "Review DEF-001. If it is a code defect, fix and add a regression test. If it reveals an uncaptured requirement or FSM transition, escalate to /up-change-request-impact." + +**Branch Integration (when parallel lanes are used):** +```bash +/up-parallel-work-integrate lane/auth-service lane/user-profile-ui +``` + +**Gate 14.1 — Iteration Definition of Done:** +```bash +# Deterministic CLI check: +python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01 + +# Or via agent skill: +/up-traceability-gate 14.1 +``` +> "@gatekeeper Run Gate 14.1 for iteration-01 — confirm all stories pass tests, automated coverage meets configured tiered thresholds (≥95% domain, ≥90% adapter, ≥80% frontend), regression tests pass, and required QA deliverables exist before marking FRs Delivered." + + +--- + +## 4. Transition (Stages 15–18) + +```bash +/up-uat-handover +``` +> "All release scope shows Delivered in the traceability graph — prepare CI/CD deployment pipelines, UAT acceptance package, and review-ready baseline in 08_review_ready_baselines/." + +--- + +## 5. Cross-Cutting: Change Request (CR) Lifecycle + +Triggered from any stage whenever requirements, scope, or NFRs change post-baseline: + +**A. Defect reveals a requirements gap:** +```bash +/up-change-request-impact +``` +> "Raise CR-001: UC-001 is missing an account-lockout policy after 5 failed attempts. Run Impact Analysis against the traceability graph before modifying any document." + +**B. New PRD/BRD requirement arrives mid-program:** +```bash +/up-change-request-impact +``` +> "Raise CR-002: Client requested OAuth2 Social Login. Compute full blast radius across FRs, HLD, LLD, Wireframes, Stories, and Test Models." + +--- + +## 6. Cross-Cutting: Meta-Governance (Process Evolution) + +If the process itself needs adjustment (new gate, modified threshold, new tool): +```bash +/up-process-change +``` +> "Propose Process-Adjustment CR: Update minimum test coverage threshold or add a new deployment validation gate." + +--- + +## 7. Cross-Cutting: Session Checkpoints + +Save and resume state across developer/agent sessions: +```bash +/up-context-checkpoint save +``` +> "Save session checkpoint in 00_process_control/checkpoints/ before handoff, recording active stage, completed tasks, and next action." + +--- + +## 8. Dual Worked End-to-End Scenarios + +### Scenario A: Greenfield Track (0-to-1 User Management) +```bash +1. /up-project-bootstrap --archetype greenfield +2. /up-brd-extract 01_BRD/PRD_Specification.md +3. /up-use-case-author UC-001 user-authentication-rbac +4. /up-traceability-gate 5.1 +5. /up-arch-risk-spike +6. /up-srs-derive UC-001 +7. /up-hld-lld-generate +8. /up-traceability-gate 9.1 +9. /up-iteration-plan +10. /up-wireframe-spec && /up-test-model-generate +11. /up-code-generate STORY-AUTH-001 +12. /up-traceability-gate 14.1 +13. /up-uat-handover +``` + +### Scenario B: Brownfield Track (Legacy Billing Modernization) +```bash +1. /up-project-bootstrap --archetype brownfield +2. /up-brd-extract 01_BRD/Modernization_Scope.md +3. /up-legacy-gap-analysis LegacyBillingModule +4. /up-use-case-author UC-010 invoice-and-payment-processing +5. /up-traceability-gate 5.1 +6. /up-arch-risk-spike +7. /up-srs-derive UC-010 +8. /up-hld-lld-generate +9. /up-traceability-gate 9.1 +10. /up-iteration-plan +11. /up-wireframe-spec && /up-test-model-generate +12. /up-code-generate STORY-BILL-001 +13. /up-traceability-gate 14.1 +14. /up-uat-handover +``` diff --git a/00_prompts/AI_Native_Unified_Process_v1.md b/00_prompts/AI_Native_Unified_Process_v1.md new file mode 100644 index 0000000..b774762 --- /dev/null +++ b/00_prompts/AI_Native_Unified_Process_v1.md @@ -0,0 +1,322 @@ +**AI-Native Unified Process + SEI-CMM Level 3 — v1.1 (Universal Generic Edition)** + +*Use-Case-Driven, Architecture-Centric, Iterative and Incremental Process for Generating Requirements, Architecture, Wireframes, Test Models, Production Code, and Cloud Deployment across Greenfield and Brownfield Initiatives* + +| Field | Description | +|---|---| +| Document Version | v1.1 (Governance-Hardened Baseline via `CR-001`) | +| Architecture Scope | Universal, stack-agnostic AI-Native Software Development Framework (`UP-AI v1.1`) | +| Source inputs | Configured via `tech-profile.yaml`: `01_BRD` / PRDs (Greenfield & Brownfield); `02_legacy_source_code` & `03_old_screenshots` (Brownfield only). | +| Target architecture | Configured via `tech-profile.yaml`: Supports Modular Monolith, Microservices, Event-Driven, or Serverless architectures; multi-tenancy models (Row-Level Security, schema-per-tenant, DB-per-tenant); cloud-agnostic containerized deployments. | +| Technology profile | Declarative `tech-profile.yaml` defining active backend, frontend, ORM, migrations, auth provider, database, governance tailoring tier, and Wave 0 integration sandboxes. | +| Tooling & Execution | Orchestrated via canonical AI Agent Skills (`.agents/skills/`), multi-agent topologies (§1.2), deterministic gate validator (`scripts/verify_traceability_gates.py`), context-checkpointing (`up-context-checkpoint`), automated test runner (`scripts/run_tests.sh`), and QA workbook compiler (`scripts/generate_manual_qa_workbook.py`). | + +--- + +# 0. Executive Summary + +## 0.1 Universal AI-Native Principles (v1.1) + +Eight core mechanics govern this universal process across all project types: + +1. **Dual-Track Inception Routing:** Greenfield projects proceed via PRD extraction, Domain-Driven Design (DDD) Bounded Contexts, and Architecture Spikes; Brownfield projects execute automated AST code mining, DB schema reverse-engineering, screenshot visual analysis, and parity gap mapping. +2. **Use Case as the Atomic Requirement Unit; FRS as a Generated Rollup:** Requirements are authored *inside* their owning use case from the start (Stage 5), eliminating requirement-UC orphan discrepancies. +3. **Continuous Deterministic Quality Gates:** Mandatory Gate Checks (Gate 5.1, Gate 9.1, Gate 14.1) validate graph completeness deterministically via `scripts/verify_traceability_gates.py` before stage transitions, blocking progress if any story or delivery surface lacks specification or test evidence. +4. **First-Class Change Request (CR) Lifecycle & Blast Radius Analysis:** Scope adjustments, defect remediations, and NFR changes compute impact graphs *before* document or code edits. +5. **Risk-Driven Architecture-Centric Elaboration:** Walking skeletons and disposable architecture spikes validate high-risk non-functional bottlenecks (concurrency, data tenancy, integration resilience) before full-breadth implementation. +6. **Wave-Based Construction Loops with Explicit Delivery Surfaces:** Construction decomposes every story across frontend, API/backend, database, integration, infrastructure, and QA surfaces. +7. **Wave 0 Deterministic Sandboxing & Test Idempotency:** External dependencies MUST provide local, deterministic sandbox adapters under `app/integrations/sandbox/`, enabling 100% offline, reproducible automated testing without third-party flakiness. +8. **Differentiated Multi-Path Automated Test Coverage & Dual QA:** Enforces multi-path automated testing (Happy, Alternate, Boundary, Negative, FSM Invariants) with tiered coverage budgets ($\ge 95\%$ core domain/FSMs, $\ge 90\%$ integration adapters, $\ge 80\%$ UI component branch coverage + Playwright E2E) and auto-compiled 21-sheet manual QA workbooks. + + +--- + +# 1. Process Philosophy — Mapping Stages to Unified Process Phases + +``` ++-----------------------------------------------------------------------------------+ +| PROJECT ARCHETYPE ROUTING | ++-----------------------------------------------------------------------------------+ + | + +---> GREENFIELD TRACK (0-to-1): + | Stage 0 (Bootstrap) -> Stage 1 (PRD/BRD) -> Stage 1B (DDD & Event Storming) + | -> Stage 6 (Arch Risk Spike) -> Stage 7 (Walking Skeleton) -> Stage 5 (Use Cases) + | + +---> BROWNFIELD TRACK (Modernization / Migration): + Stage 0 (Bootstrap) -> Stage 1 (BRD Scope) -> Stage 2 (AST & API Mining) + -> Stage 3 (DB Schema & UI Mining) -> Stage 4 (Gap/Parity Analysis) -> Stage 5 (Use Cases) + | + v ++-----------------------------------------------------------------------------------+ +| ELABORATION: Gate 5.1 -> Stage 8 (SRS Derivation) -> Stage 9 (HLD/LLD) -> Gate 9.1| ++-----------------------------------------------------------------------------------+ + | + v ++-----------------------------------------------------------------------------------+ +| CONSTRUCTION LOOP (Repeats per Iteration Slice): | +| Stage 10 (Plan) -> Stage 11 (Screens/Specs) -> Stage 12 (Test Model & QA Workbook) | +| -> Stage 13 (Wave-Based Code Gen) -> Stage 14 (Review, Defect Fix & Gate 14.1) | ++-----------------------------------------------------------------------------------+ + | + v ++-----------------------------------------------------------------------------------+ +| TRANSITION: Stage 15 (DevOps/CI-CD) -> Stage 16 (UAT) -> Stage 17 (Handover) | ++-----------------------------------------------------------------------------------+ +``` + +## 1.1 UP Phases & Risk Retirement + +| UP Phase | Stages | Primary objective | Risk being retired | +|---|---|---|---| +| **Inception** | 0 – 4 | Establish project archetype, stack profile (`tech-profile.yaml`), scope boundaries, and domain/legacy catalog | Scope and requirements-source risk | +| **Elaboration** | 5 – 9 (+ Gates 5.1, 9.1) | Build use-case requirements spine, validated architecture walking skeleton, and full SRS/HLD/LLD | Requirements-volatility and architecture risk | +| **Construction** *(iterative)* | 10 – 14 (+ Gate 14.1) | Build, test, and integrate working software one vertical slice at a time across explicit delivery surfaces | Delivery and integration risk | +| **Transition** | 15 – 18 | Containerized deployment, CI/CD pipelines, UAT acceptance, and client handover package | Operational and adoption risk | + +## 1.2 Multi-Agent & Sub-Agent Topology + +AI-Native execution delegates specialized tasks to defined agent roles: +- **`@requirements-analyst`**: Extracts PRD/BRD requirements, resolves ambiguities, authors self-contained use cases and functional requirements. +- **`@spike-architect`**: Scores architectural risks (`RISK-xxx`), builds high-risk walking skeletons, designs domain HLD/LLD templates. +- **`@backend-dev`**: Generates schemas, migrations, deterministic API routers, business FSMs, and Wave 0 mock sandboxes. +- **`@ui-designer-dev`**: Applies `DESIGN.md` tokens, creates wireframe screen specs, builds responsive frontend views and component tests. +- **`@adversarial-tester`**: Generates multi-path test suites (≥95% coverage), Bruno API collections, Playwright E2E specs, and 21-sheet Excel workbooks. +- **`@gatekeeper`**: Enforces quality gates (5.1, 9.1, 14.1), verifies delivery-surface completeness, calculates CR blast radiuses. + +--- + +# 2. Governing Artifact & ID Scheme (the single spine) + +## 2.1 The Chain + +``` +BRD-FR-xxx (business requirement, from BRD) + └─▶ UC-xxx (use case — the atomic requirement-owning unit) + └─▶ FR-xxx (functional requirement, CHILD of exactly one UC; may cite one or more BRD-FR) + ├─▶ NFR-xxx / SRS-xxx (system requirement derived from FR + cross-cutting NFRs) + ├─▶ HLD- (owning architecture component) + │ └─▶ LLD-API-xxx / LLD-TBL-xxx / LLD-EVT-xxx + │ └─▶ STORY-xxx (implementation story, scoped to one iteration) + │ └─▶ TC-xxx (test case — carries a `test_level`: Unit | API-Integration | + │ Contract | Browser-E2E | Smoke | Usability | Regression; + │ `TC-UAT-*` is the naming subtype for acceptance/UAT scenarios) +``` + +Cross-cutting governance IDs: `DEC-xxx` (decision), `AMB-xxx` (ambiguity), `ASM-xxx` (assumption), `CR-xxx` (change request), `RISK-xxx` (architectural risk score). + +## 2.2 Non-negotiable Rules (enforced by Gates) + +1. Every `UC-xxx` must have **at least one** `FR-xxx` child before Stage 5 can exit. Every `FR-xxx` must declare exactly one `parent_uc`. +2. Every `FR-xxx` must resolve to at least one `SRS-xxx`/`NFR-xxx`, one `HLD` component, and one `LLD` artifact before Stage 9 can exit. +3. Every `STORY-xxx` delivered inside an iteration must resolve to at least one passing `TC-xxx` before that iteration's Gate 14.1 can close. +4. Every in-scope FR/story must have an iteration delivery-surface row covering applicable frontend portal/screen, API/backend, database, integration, infrastructure, and QA work. A non-applicable or deferred surface must be explicitly recorded with its reason and governing `CR-xxx`/`DEC-xxx`. +5. Every artifact file carries a front-matter block: `id`, `parent_id(s)`, `version`, `status` (Draft / Reviewed / Baselined / Superseded), `last_cr` (the CR-xxx that most recently touched it, or "none"). +6. There is exactly **one** traceability graph (`00_process_control/traceability_graph.md`). +7. Every `STORY-xxx` must carry an explicit per-type test applicability decision for Unit, Smoke, and Usability — each recorded as Required (with derived `TC-xxx`) or N/A (with a stated reason) — before Gate 14.1 can close. +8. **Differentiated Automated Test Coverage Budgets:** All code must meet the coverage thresholds configured in `tech-profile.yaml`: + - **Backend Domain Services & State Machines:** **≥95.0%** statement and branch coverage (Hard Gate). + - **Integration Adapters & Sandboxes:** **≥90.0%** statement and branch coverage against Wave 0 mocks. + - **Frontend UI Components:** **≥80.0%** component branch coverage + mandatory Playwright browser-E2E test suites for all primary user journeys. + Every user story must be tested across at least four dimensions: Happy Path, Alternate & Boundary/Edge Cases, Negative/Validation Failures, and FSM Invariant/Concurrency flows. +9. **Deterministic Gate Verification:** Quality Gates 5.1, 9.1, and 14.1 MUST be executed and verified via `scripts/verify_traceability_gates.py`. AI agents cannot self-certify gate closure without clean CLI validation evidence. + + +--- + +# 3. Chronological Folder Structure + +``` +04_generated_documentation/ +├── 00_process_control/ # Stage 0: Master Context, Registers, Decisions, Checkpoints +│ ├── master_context.md +│ ├── assumptions_register.md +│ ├── vocabulary_glossary.md +│ ├── decision_log.md +│ ├── ambiguity_register.md +│ ├── architecture_risk_register.md +│ ├── traceability_index.md +│ ├── traceability_graph.md # SINGLE source of truth for the traceability spine +│ ├── change_request_register.md +│ └── checkpoints/ +│ ├── checkpoint_index.md +│ └── checkpoint-001-bootstrap-baseline.md +├── 01_source_inventories/ # Stage 1: PRD/BRD Feature Extractions (BRD-FR-xxx) +│ └── brd_inventory.md +├── 02_legacy_analysis/ # Stages 2–4: Brownfield Legacy AST, DB & Screen Mining +├── 03_requirements/ # Stages 5 & 8: Atomic Use Cases (UC-xxx) & System Reqs +│ └── use_cases/ +│ └── uc-001_user-authentication/ +│ ├── use-case.md +│ └── functional-reqs.md +├── 04_architecture_design/ # Stages 6, 7, 9: Risk Spike, HLD, LLD API/Table Contracts +│ ├── hld.md +│ └── lld/ +│ └── LLD-001_auth_service.md +├── 05_iteration_planning/ # Stage 10: Iteration Backlog, Plan, Surface Matrix +│ └── iterations/ +│ └── iteration-01/ +│ ├── iteration_plan.md +│ ├── iteration_backlog.md +│ ├── iteration_surface_matrix.md +│ └── parallel_work_plan.md +├── 06_wireframes/ # Stage 11: Screen Specifications, Design Tokens (DESIGN.md) +│ ├── DESIGN.md +│ └── wireframe_index.md +├── 07_test_design/ # Stage 12: Test Strategy, Multi-Path Models, QA Workbooks +│ ├── test_strategy.md +│ ├── regression_test_cases.md +│ ├── functional_test_cases/ +│ │ └── TC-001_auth_service.md +│ └── manual_qa/ +│ ├── iteration-01/ +│ │ └── MANUAL_TESTING_GUIDE.md +│ └── workbooks/ +└── 08_review_ready_baselines/ # Stage 18: Handover & Acceptance Baselines +``` + +--- + +# 4. PHASE I — INCEPTION (Stages 0–4) + +## Stage 0 — Workspace and Governance Bootstrap + +**Objective:** Create a controlled workspace, parse `tech-profile.yaml`, and generate governance registers before deep analysis. + +**Output Expected:** `master_context.md`, `assumptions_register.md`, `vocabulary_glossary.md`, `decision_log.md`, `folder_discovery_report.md`. + +## Stage 1 — Business Requirements (PRD/BRD) Extraction + +**Objective:** Extract every discrete business capability and mint `BRD-FR-xxx` IDs in `01_source_inventories/brd_inventory.md`. + +## Stages 2–4 — Brownfield Legacy Code, DB & Screen Mining (Brownfield Only) + +**Objective:** Reverse-engineer legacy codebases, extract database schemas, and map screen flows into `02_legacy_analysis/`. + +--- + +# 5. PHASE II — ELABORATION (Stages 5–9) + +## Stage 5 — Use Case Authoring with Embedded Functional Requirements + +**Objective:** Author each use case as the single, atomic requirements-owning artifact under `03_requirements/use_cases/uc-xxx/` containing `use-case.md` and `functional-reqs.md` (`FR-xxx`). + +## Stage 6 — Architectural Risk Ranking + +**Objective:** Score every use case across 5 risk dimensions (Data Isolation, External Dependencies, Financial Sensitivity, Throughput, Novelty) in `00_process_control/architecture_risk_register.md` to identify architecturally significant use cases. + +## Stage 7 — Architecture Spike & Walking Skeleton Validation + +**Objective:** Build and validate a thin end-to-end walking skeleton against the highest-risk use cases before full-breadth implementation. + +## Stage 8 — System Requirements (SRS/NFR) Derivation + +**Objective:** Derive system requirements (APIs, data models, integration formats, audit rules, NFRs) from the gated functional requirements under `03_requirements/`. + +## Stage 9 — High-Level & Low-Level Design (HLD/LLD) Fan-Out + +**Objective:** Produce modular HLD service designs and detailed LLD contracts (API endpoints, database tables, event schemas) in `04_architecture_design/`. + +--- + +# 6. PHASE III — CONSTRUCTION LOOP (Stages 10–14) + +Repeats iteratively for each vertical slice of 3–8 use cases: + +## Stage 10 — Iteration Planning & Delivery Surface Matrix + +**Objective:** Produce `05_iteration_planning/iterations/iteration-NN/` containing `iteration_plan.md`, `iteration_backlog.md`, `iteration_surface_matrix.md`, and `parallel_work_plan.md`. + +## Stage 11 — Wireframe & Field-Level Screen Specifications + +**Objective:** Reconcile screens against `06_wireframes/DESIGN.md` and produce screen specifications and `wireframe_index.md`. + +## Stage 12 — Multi-Path Test Modeling, Bruno API Collections & QA Workbooks + +**Objective:** Generate unit, API, contract, browser-E2E, smoke, and usability test cases in `07_test_design/`, create Bruno API collections under `docs/api/bruno/`, and produce both the Markdown testing guide and the 21-sheet Excel workbook. + +## Stage 13 — Wave-Based Code Generation (≥95% Coverage) + +**Objective:** Implement stories across backend, frontend, database migrations, and integration adapters, achieving **≥95.0% automated statement and branch coverage**. + +## Stage 14 — Code Review, Defect Fix & Gate 14.1 Definition of Done + +**Objective:** Review code, resolve defects, integrate parallel lanes (`up-parallel-work-integrate`), and verify Gate 14.1 closure. + +--- + +# 7. PHASE IV — TRANSITION (Stages 15–18) + +## Stage 15 — DevOps & CI/CD Pipeline Scaffolding +## Stage 16 — UAT Release Preparation & Verification +## Stage 17 — Client Handover Packaging +## Stage 18 — Review-Ready Baselines (`08_review_ready_baselines/`) + +--- + +# 8. Cross-Cutting Governance Mechanics + +## 8.1 Change Request (CR) Lifecycle & Blast Radius Analysis + +Any scope change, requirements gap, or NFR adjustment is raised as `CR-xxx`. The agent walks the single traceability graph to compute the blast radius across requirements, architecture, wireframes, stories, and test models BEFORE modifying any document or code. + +## 8.2 Checkpoint / Resume Mechanic (`up-context-checkpoint`) + +Stores lightweight checkpoints in `00_process_control/checkpoints/` capturing the active stage, completed scope, open items, and exact next action, enabling multi-agent continuity. + +## 8.3 Parallel Work & Lane Isolation Protocol (`up-parallel-work-integrate`) + +Governs parallel AI-assisted work across isolated branches and reconciles governance IDs and contracts semantically at integration. + +## 8.4 Multi-Level Test Execution (`scripts/run_tests.sh`) + +Unified command surface running automated tests at project, iteration, use case, or requirement scope (`--scope `). + +## 8.5 CMMI-Compliant 3-Tier Tailoring Framework + +To balance engineering rigor with cycle-time economics across initiatives of varying risk, UP-AI v1.1 defines three standardized process tailoring tiers configured in `tech-profile.yaml`: + +| Tailoring Tier | Target Project Profile | Mandatory Stages & Gates | Quality & Coverage Profile | +|---|---|---|---| +| **Tier 1: High-Assurance** | Financial, medical, mission-critical, or multi-tenant compliance systems. | All 18 Stages; Gates QG-I, 5.1, 9.1, QG-E, 14.1, QG-T. All CRs require pre-blast analysis. | $\ge 95\%$ coverage across all layers; 21-sheet Excel QA workbooks; dual browser/API suites. | +| **Tier 2: Standard Enterprise** *(Default)* | Commercial web apps, SaaS services, internal line-of-business platforms. | Stages 0, 1, 5, 6–7, 8, 9, 10–14, 15, 16, 17. Gates 5.1, 9.1, 14.1. | $\ge 95\%$ backend domain/FSMs, $\ge 90\%$ integration adapters, $\ge 80\%$ frontend components + Playwright E2E; Markdown QA guide. | +| **Tier 3: Fast-Track Prototype** | Internal proofs-of-concept, hackathons, non-production exploratory spikes. | Stage 0 (Bootstrap), Stage 10 (Plan), Stage 13 (Code Gen), Stage 14 (Review). Gate 14.1 only. | $\ge 80\%$ backend; smoke tests; minimal documentation overhead. | + +## 8.6 Human Review Optimization & Decision Diff Briefs + +To prevent reviewer cognitive fatigue and "automation bias" (rubber-stamping voluminous AI-generated markdown), every major milestone submission to human authorities MUST include a concise, high-signal **Human Review Brief**: +1. **Core Problem & Solved Need:** One-paragraph executive rationale. +2. **Key Architectural Decisions & Trade-offs:** Rejected alternatives and reasons. +3. **Assumptions & Security Boundaries:** Tenancy, RBAC, and data isolation assumptions. +4. **Targeted Review Points:** Explicit request for human evaluation on identified ambiguities or edge-case business logic. + +## 8.7 Deterministic Quality Gate Automation (`scripts/verify_traceability_gates.py`) + +Quality Gates 5.1, 9.1, and 14.1 are enforced via an executable Python tool that verifies referential integrity, orphan-freedom, and delivery completeness across file frontmatters and directories. Passing this deterministic CLI check is mandatory before gate closure. + +## 8.8 Meta-Governance Process Updates (`up-process-change`) + +Process adjustments follow the same formal change lifecycle as product code, incrementing document minor versions (v1.1, v1.2, ...) with an audit trail in Appendix A. + +--- + +# 9. Quality Gates Master Table + +| Gate | Before Moving To | Approval Criteria | Enforced By | +|---|---|---|---| +| **QG-I** | Elaboration | BRD catalogued (`BRD-FR-xxx` assigned); domain context established; gap list produced. | `@requirements-analyst` | +| **Gate 5.1** | Stage 6 (Risk Ranking) | Zero UC with no FR; zero FR with invalid `parent_uc`. | `python3 scripts/verify_traceability_gates.py --gate 5.1` | +| **Gate 9.1** | Construction | Zero FR without SRS + HLD + LLD linkage. | `python3 scripts/verify_traceability_gates.py --gate 9.1` | +| **QG-E** | Construction (Stage 10) | Architecture baseline validated; Gates 5.1 and 9.1 both pass. | `@gatekeeper` | +| **Gate 14.1** | Next Iteration / Transition | Every STORY has a passing TC; explicit Unit/Smoke/Usability applicability decisions; automated coverage meets tiered budget ($\ge 95\%$ domain, $\ge 90\%$ adapter, $\ge 80\%$ frontend); cumulative regression suite passes; all delivery surfaces evidenced; real browser QA validated; required QA deliverables present; parallel lanes integrated cleanly. | `python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-NN` | +| **QG-T** | Production Deployment | UAT passed; production readiness checklist passed; traceability graph 100% Delivered-or-Deferred-with-CR. | `@gatekeeper` | + +--- + +# Appendix A — Version Changelog + +| Version | Date Scope | Summary | +|---|---|---| +| **v1.0** | 2026-09-03 | Initial baselined release of the universal, stack-agnostic **AI-Native Unified Process Framework (UP-AI v1.0)**. Incorporates native dual-track inception, atomic use-case requirements authoring, continuous traceability gates (5.1, 9.1, 14.1), formal change request blast-radius analysis, risk-driven elaboration spikes, wave-based construction loops with 11-dimension delivery surfaces, Wave 0 deterministic sandboxes, ≥95.0% multi-path automated test coverage, 21-sheet manual QA workbook compilation, and single canonical skill layout (`.agents/skills/`). | +| **v1.1** | 2026-10-03 | **Governance & Automation Hardening (`CR-001`):** (1) Implemented deterministic CLI gate validator `scripts/verify_traceability_gates.py` for Gates 5.1, 9.1, and 14.1 to eliminate agent self-policing bias; (2) Added CMMI 3-tier process tailoring matrix (§8.5) in `tech-profile.yaml` (High-Assurance, Standard Enterprise, Fast-Track); (3) Formulated Human Review Optimization Brief protocol (§8.6) to mitigate automation bias/fatigue; (4) Formalized differentiated coverage budgets (§2.2 Rule 8) separating core domain FSMs ($\ge 95\%$) from adapters ($\ge 90\%$) and frontend components ($\ge 80\%$ + Playwright E2E). | +| **v1.2+** | (Future) | Process adjustments approved via `CR-xxx` (Trigger Type `Process-Adjustment`) are version-bumped and recorded here per §8.8. | + diff --git a/00_prompts/templates/tech-profile.template.yaml b/00_prompts/templates/tech-profile.template.yaml new file mode 100644 index 0000000..6aec384 --- /dev/null +++ b/00_prompts/templates/tech-profile.template.yaml @@ -0,0 +1,112 @@ +# ============================================================================== +# AI-Native Unified Process (UP-AI v1.0) - Declarative Technology Profile Template +# ============================================================================== +# Copy this template to `/tech-profile.yaml` at the root of your project workspace. +# Configure the technology stack, project archetype, test tools, and integration +# sandboxes according to your project requirements. +# +# All UP-AI agent skills dynamically read this profile during Inception, +# Elaboration, Construction, and Transition phases. +# ============================================================================== + +project: + name: "Target Application Name" + code: "APP" + version: "1.0.0" + description: "Target system executive description" + # Archetype: 'greenfield' (0-to-1 development) or 'brownfield' (legacy modernization/migration) + archetype: "greenfield" + +# Inception Configuration +inception: + # Source document paths + requirements_inputs: + - "01_BRD/PRD_Specification.md" + # Brownfield-only sources (ignored if archetype is greenfield) + legacy_sources: + source_code_dir: "02_legacy_source_code" + database_dump_dir: "02_legacy_source_code/schema" + screenshots_dir: "03_legacy_screen_shots" + +# Architecture & Target Technology Stack +stack: + architecture_pattern: "modular_monolith" # Options: modular_monolith | microservices | event_driven | serverless + multi_tenancy: + enabled: true + model: "row_level_security" # Options: row_level_security | schema_per_tenant | database_per_tenant + + backend: + language: "python" # Options: python | typescript | go | java | csharp | rust + framework: "fastapi" # Options: fastapi | django | express | nestjs | gin | spring_boot | dotnet_core + orm: "sqlalchemy" # Options: sqlalchemy | prisma | typeorm | gorm | hibernate | ef_core + migrations: "alembic" # Options: alembic | prisma | flyway | golang_migrate | dbup + api_standard: "rest_openapi" # Options: rest_openapi | graphql | grpc + test_framework: "pytest" + coverage_tool: "pytest-cov" + + frontend: + framework: "react" # Options: react | vue | angular | svelte | nextjs | flutter + language: "typescript" + state_management: "zustand" # Options: zustand | redux_toolkit | pinia | context_api + ui_library: "tailwind_shadcn" # Options: tailwind_shadcn | mui | ant_design | vanilla_css + design_system_tokens: "04_generated_documentation/06_wireframes/DESIGN.md" + test_framework: "vitest" + e2e_framework: "playwright" + + authentication: + provider: "keycloak" # Options: keycloak | auth0 | cognito | supabase_auth | firebase_auth | custom_oidc + protocol: "oidc_pkce" + token_standard: "jwt_bearer" + authorization_model: "rbac_abac" # Options: rbac | rbac_abac | casbin | opa + + database: + primary: "postgresql" # Options: postgresql | mysql | mariadb | mongodb | dynamodb + cache_and_streams: "valkey" # Options: valkey | redis | none + search_engine: "none" # Options: elasticsearch | opensearch | pg_trgm | none + +# Wave 0 Integration Sandboxes +# Every third-party external dependency MUST declare a deterministic mock/sandbox adapter. +sandboxes: + - id: "identity_provider" + service_name: "Auth & Identity" + mock_adapter_path: "sandbox/identity_mock.py" + mock_mode: "deterministic" # Options: deterministic | replay | live_proxy + - id: "payment_gateway" + service_name: "Payment & Settlement" + mock_adapter_path: "sandbox/payment_mock.py" + mock_mode: "deterministic" + - id: "messaging_service" + service_name: "SMS / Email Notification" + mock_adapter_path: "sandbox/notification_mock.py" + mock_mode: "deterministic" + +# Governance & Process Tailoring (CMMI Level 3 / UP-AI v1.1) +governance: + # Tailoring Tier Options: + # - 'tier_1_high_assurance' (Mission-critical / Financial: All 18 stages, >=95% coverage across all tiers, dual QA) + # - 'tier_2_standard_enterprise' (Default: Core UP flow, differentiated coverage, standard QA deliverables) + # - 'tier_3_fast_track' (Internal prototypes: Direct to construction, unit/smoke testing, minimal ceremony) + tailoring_tier: "tier_2_standard_enterprise" + enforce_deterministic_gates: true + gate_validator_script: "scripts/verify_traceability_gates.py" + +# Quality Targets & Gate 14.1 Mandates +quality_targets: + # Differentiated Coverage Budgets (UP-AI v1.1) + coverage_thresholds: + backend_domain_fsm: 95.0 # Hard gate for core business FSMs, algorithms, security + integration_adapters: 90.0 # Deterministic sandbox verification + frontend_components: 80.0 # UI component branch coverage + mandatory Playwright E2E + test_coverage_threshold: 95.0 # Baseline fallback + required_test_dimensions: + - "happy_path" + - "alternate_and_boundary" + - "negative_validation_failures" + - "fsm_invariants_and_concurrency" + required_test_levels: + - "unit" + - "api_contract_bruno" + - "browser_e2e_playwright" + - "smoke" + - "manual_qa_workbook_21_sheets" # Enforced by Gate 14.1 + diff --git a/01_BRD/PRD_Specification.template.md b/01_BRD/PRD_Specification.template.md new file mode 100644 index 0000000..559e2d5 --- /dev/null +++ b/01_BRD/PRD_Specification.template.md @@ -0,0 +1,44 @@ +# Product Requirements Document (PRD) — Universal Enterprise Platform + +| Field | Value | +|---|---| +| **Document** | `PRD_Specification.md` | +| **Product** | Universal Enterprise Platform (UEP) | +| **Version** | 1.0.0 | +| **Author** | Product Management | +| **Status** | Approved Baseline | + +--- + +## 1. Executive Summary & Vision + +The Universal Enterprise Platform (UEP) provides an extensible, multi-tenant digital backbone for modern enterprise workflows. It unifies user identity, role-based access governance, core business domain operations, and external API integrations under a coherent, secure, and observable cloud architecture. + +--- + +## 2. Target Personas & User Classes + +1. **System Administrator:** Manages tenant provisioning, organization-wide configuration, and system audit logs. +2. **Tenant Administrator:** Manages tenant-scoped users, roles, permissions, and departmental settings. +3. **End User:** Executes day-to-day domain workflows within their assigned tenant boundary. +4. **Integration Service Account:** Automated API consumer communicating via secure OAuth2 client credentials. + +--- + +## 3. High-Level Feature Inventory (BRD-FR Root Spine) + +| Feature ID | Feature Title | Primary Persona | Description | Priority | +|---|---|---|---|---| +| `BRD-FR-001` | Multi-Tenant User Authentication | All Users | Support secure login via OIDC/PKCE with multi-tenant context propagation. | P0 | +| `BRD-FR-002` | Role-Based Access Control (RBAC) | Tenant Admin | Granular permission assignment and role scoping per tenant organization. | P0 | +| `BRD-FR-003` | User Session & Token Revocation | All Users | Real-time session monitoring, token refresh rotation, and instant logout. | P1 | +| `BRD-FR-004` | Audit & Compliance Event Stream | System Admin | Immutable logging of all security, authentication, and state-mutation actions. | P1 | + +--- + +## 4. Non-Functional Requirements & Constraints + +1. **Multi-Tenancy & Isolation:** All domain data MUST be strictly isolated by `tenant_id` at the database level using PostgreSQL Row-Level Security (RLS). +2. **Security & Cryptography:** Zero plaintext passwords or secrets; TLS 1.3 in transit; AES-256 at rest. +3. **Performance:** $\le 200\text{ ms}$ p95 API response latency for standard CRUD endpoints. +4. **Reliability:** 99.9% uptime SLA with zero data loss on service restart. diff --git a/04_generated_documentation/00_process_control/ambiguity_register.md b/04_generated_documentation/00_process_control/ambiguity_register.md new file mode 100644 index 0000000..1e73ae3 --- /dev/null +++ b/04_generated_documentation/00_process_control/ambiguity_register.md @@ -0,0 +1,17 @@ +# Ambiguity & Clarification Register + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/ambiguity_register.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## Ambiguity Lifecycle + +Open requirements questions, ambiguous edge cases, and underspecified third-party integration contracts are tracked here (`AMB-xxx`). Unresolved questions MUST NOT be guessed by AI agents. + +| ID | Date | Stage | Ambiguity / Question | Context & Impact | Resolution / Decision | Status | Resolved By | +|---|---|---|---|---|---|---|---| +| AMB-001 | 2026-09-03 | Stage 0 | Session timeout duration and refresh token rotation policy for web portals vs. mobile clients. | Impacts session management in LLD-001 Auth Service. | Standardize on 15-minute access token and 7-day refresh token with rotation. | Resolved | `DEC-002` / Security Lead | diff --git a/04_generated_documentation/00_process_control/architecture_risk_register.md b/04_generated_documentation/00_process_control/architecture_risk_register.md new file mode 100644 index 0000000..3333a71 --- /dev/null +++ b/04_generated_documentation/00_process_control/architecture_risk_register.md @@ -0,0 +1,26 @@ +# Architecture Risk Register + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/architecture_risk_register.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## 1. Architectural Risk Dimensions (1 to 5 Scale) + +1. **D1: Data Isolation & Multi-Tenancy:** Cross-tenant boundaries, RLS schema isolation complexity. +2. **D2: External Integration Dependency:** Third-party APIs, external identity providers, payment gateways, messaging. +3. **D3: Financial & Transactional Sensitivity:** Ledgers, payment processing, irreversible state transitions. +4. **D4: Throughput & Concurrency:** High-volume streaming, live event ingestion, background queue locks. +5. **D5: Novelty & Uncertainty:** Complex algorithms, lack of precedent, unproven patterns. + +--- + +## 2. Use Case Risk Scoring Matrix + +| UC-ID | Use Case Name | D1 | D2 | D3 | D4 | D5 | Total Score | Rank | Architecturally Significant (Y/N) | Architecture Rationale | +|---|---|---|---|---|---|---|---|---|---|---| +| `UC-001` | User Identity & Role Governance | 5 | 4 | 2 | 3 | 2 | **16** | 1 | **Yes** | Multi-tenant tenant context extraction, Keycloak OIDC/PKCE integration, RLS context propagation. Validated in Stage 7 Walking Skeleton. | +| `UC-002` | User Profile & Preferences | 3 | 1 | 1 | 1 | 1 | **7** | 2 | **No** | Standard CRUD operations; inherits service template and RLS pattern from `UC-001`. | diff --git a/04_generated_documentation/00_process_control/assumptions_register.md b/04_generated_documentation/00_process_control/assumptions_register.md new file mode 100644 index 0000000..0ce60ab --- /dev/null +++ b/04_generated_documentation/00_process_control/assumptions_register.md @@ -0,0 +1,17 @@ +# Assumptions Register + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/assumptions_register.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## Active Assumptions + +| ID | Date | Stage | Assumption | Basis | Risk Level | Status | Superseded By | +|---|---|---|---|---|---|---|---| +| ASM-001 | 2026-09-03 | Stage 0 | Target architecture is a modular monolith with Row-Level Security (RLS) tenant isolation per `tech-profile.yaml`. | Standard UP-AI greenfield profile baseline. | Low | Active | — | +| ASM-002 | 2026-09-03 | Stage 0 | Authentication is delegated to an OIDC provider (Keycloak) using Authorization Code Flow with PKCE. | Enterprise identity architecture standard. | Low | Active | — | +| ASM-003 | 2026-09-03 | Stage 0 | All third-party external integrations will provide deterministic Wave 0 mock adapters for 100% offline CI/CD execution. | UP-AI v1.0 deterministic testability standard. | Low | Active | — | diff --git a/04_generated_documentation/00_process_control/change_request_register.md b/04_generated_documentation/00_process_control/change_request_register.md new file mode 100644 index 0000000..e2c9165 --- /dev/null +++ b/04_generated_documentation/00_process_control/change_request_register.md @@ -0,0 +1,19 @@ +# Change Request (CR) Register + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/change_request_register.md` | +| **Gated By** | `up-change-request-impact`, `up-process-change` | +| **Baseline Version** | UP-AI v1.0 Baseline (Clean Register) | +| **Last Updated** | 2026-09-03 | + +--- + +## Active & Historical Change Requests + +| CR-ID | Trigger Type | Raised By | Date | Originating Stage | Description | Affected Items | Blast Radius / Impact | Disposition | Status | +|---|---|---|---|---|---|---|---|---|---| +| `CR-001` | Process-Adjustment | Joint (User/Assistant) | 2026-10-03 | Meta-Governance | Upgrade UP-AI framework to v1.1: (1) Add deterministic CLI gate validator `scripts/verify_traceability_gates.py`, (2) Formalize CMMI 3-tier process tailoring matrix, (3) Integrate Human Review Brief protocol, and (4) Differentiate test coverage targets in `tech-profile.yaml`. | `AI_Native_Unified_Process_v1.md`, `tech-profile.yaml`, `tech-profile.template.yaml`, `.agents/skills/up-traceability-gate/SKILL.md`, `.agents/skills/up-code-generate/SKILL.md`, `.agents/skills/up-test-model-generate/SKILL.md`, `README.md`, `scripts/verify_traceability_gates.py` | Process spec §2.2, §8.5, §8.6, §9, Appendix A; tech profile configs; 3 canonical skills; 1 new CLI tool. | Approved | Closed | + + diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-001-bootstrap-baseline.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-001-bootstrap-baseline.md new file mode 100644 index 0000000..05fea81 --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint-001-bootstrap-baseline.md @@ -0,0 +1,27 @@ +# Checkpoint 001 — Framework Bootstrap & Generic Baseline + +- **Checkpoint ID:** `CKPT-001` +- **Date:** 2026-09-03 +- **Active Stage:** Stage 0 (Inception) +- **Active Track:** Greenfield / Universal +- **Process Version:** UP-AI v1.0 + +--- + +## 1. Completed in this Session +- Initialized active `tech-profile.yaml` from declarative template. +- Established canonical CMMI governance registers under `04_generated_documentation/00_process_control/`. +- Baselined generic reference use case `UC-001` (User Identity & Role Governance). +- Consolidated all 18 canonical agent skills directly into `.agents/skills/`. + +--- + +## 2. Mid-Flight / Open Items +- None (Clean baseline established). + +--- + +## 3. Exact Next Action +- To extract business requirements from a new PRD: `/up-brd-extract 01_BRD/PRD_Specification.md` +- To author additional use cases: `/up-use-case-author UC-002 ` +- To plan Iteration 01 construction: `/up-iteration-plan` diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint-002-v1.1-governance-hardening.md new file mode 100644 index 0000000..e69de29 diff --git a/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md new file mode 100644 index 0000000..6de29da --- /dev/null +++ b/04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md @@ -0,0 +1,18 @@ +# Checkpoints Index + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.1) | +| **Document Path** | `04_generated_documentation/00_process_control/checkpoints/checkpoint_index.md` | +| **Gated By** | `up-context-checkpoint` | +| **Last Updated** | 2026-10-03 | + +--- + +## Master Checkpoint Index + +| Checkpoint ID | Date | Active Stage / Gate | Completed Scope | Pending Decisions / Blockers | Next Action | Pointer File | +|---|---|---|---|---|---|---| +| `CKPT-001` | 2026-09-03 | Stage 0 (Bootstrap Baseline) | Workspace initialized with `tech-profile.yaml`, generic governance registers, and `UC-001` reference slice. | None | Author new use cases with `/up-use-case-author` or plan iteration with `/up-iteration-plan`. | `checkpoint-001-bootstrap-baseline.md` | +| `CKPT-002` | 2026-10-03 | Meta-Governance / Cross-Cutting | UP-AI v1.1 Hardening: CLI gate validator (`scripts/verify_traceability_gates.py`), CMMI 3-tier tailoring, review brief protocol, differentiated coverage. CR-001 closed. | None | Extract PRD requirements with `/up-brd-extract` or implement `iteration-01` with `/up-code-generate`. | `checkpoint-002-v1.1-governance-hardening.md` | + diff --git a/04_generated_documentation/00_process_control/decision_log.md b/04_generated_documentation/00_process_control/decision_log.md new file mode 100644 index 0000000..45c1604 --- /dev/null +++ b/04_generated_documentation/00_process_control/decision_log.md @@ -0,0 +1,17 @@ +# Decision Log + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/decision_log.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## Architectural & Process Decisions + +| ID | Date | Stage | Decision | Rationale | Alternatives Considered | Impact | Made By | +|---|---|---|---|---|---|---|---| +| DEC-001 | 2026-09-03 | Stage 0 | Adopt Modular Monolith with Row-Level Security for Phase 1. | Maximizes initial construction velocity while guaranteeing strict tenant data isolation from day one. | Microservices-from-day-one; separate DB per tenant. | Scopes Phase 1 architecture to internal module boundaries. | Lead Architect | +| DEC-002 | 2026-09-03 | Stage 0 | Standardize on Keycloak OIDC with Authorization Code Flow & PKCE. | Industry standard protocol supporting multi-tenancy, RBAC, and standard JWT claims. | Custom homegrown auth; Auth0 cloud-only. | All frontend portals use standard Keycloak OIDC redirects. | Security Lead | +| DEC-003 | 2026-09-03 | Stage 0 | Enforce ≥95.0% automated multi-path test coverage at Gate 14.1. | Prevents silent regression debt and ensures multi-dimensional test verification across all user stories. | 80% line coverage; manual testing only. | Requires Happy, Alternate, Negative, and FSM tests per story. | QA Lead | diff --git a/04_generated_documentation/00_process_control/folder_discovery_report.md b/04_generated_documentation/00_process_control/folder_discovery_report.md new file mode 100644 index 0000000..2140ff6 --- /dev/null +++ b/04_generated_documentation/00_process_control/folder_discovery_report.md @@ -0,0 +1,24 @@ +# Folder Discovery & Input Processing Report + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/folder_discovery_report.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## 1. Input Directories & Files + +| # | Item Name | Relative Path | Type | Purpose | Target Stage | Processing Notes | +|---|---|---|---|---|---|---| +| 1 | `PRD_Specification.md` | `01_BRD/PRD_Specification.md` | Markdown | Primary Business Requirements Document (PRD/BRD) | Stage 1: Feature Extraction (`up-brd-extract`) | Extract all functional features to `brd_inventory.md` (`BRD-FR-xxx`). | +| 2 | `tech-profile.yaml` | `tech-profile.yaml` | YAML | Active technology stack configuration & quality thresholds | All Stages | Read by all agent skills for architecture and code generation. | + +--- + +## 2. Recommended Processing Sequence + +1. **Stage 1 (Feature Extraction):** Read `01_BRD/` inputs and mint `BRD-FR-xxx` items in `04_generated_documentation/01_source_inventories/brd_inventory.md`. +2. **Stage 5 (Use Case Authoring):** Author atomic use cases under `04_generated_documentation/03_requirements/use_cases/` embedding `FR-xxx` children. +3. **Gate 5.1:** Run `up-traceability-gate` to enforce complete UC $\leftrightarrow$ FR linkage before architecture elaboration. diff --git a/04_generated_documentation/00_process_control/master_context.md b/04_generated_documentation/00_process_control/master_context.md new file mode 100644 index 0000000..cf062e4 --- /dev/null +++ b/04_generated_documentation/00_process_control/master_context.md @@ -0,0 +1,80 @@ +# Universal Enterprise Platform — Master Context + +| Field | Value | +|---|---| +| **Project** | Universal Enterprise Platform (UEP) | +| **Code** | `UEP` | +| **Archetype** | Greenfield (0-to-1) | +| **Active Process** | AI-Native Unified Process (UP-AI v1.1) | +| **Governance Standard** | SEI-CMMI Level 3 Equivalent | +| **Last Updated** | 2026-10-03 | + + +--- + +## 1. Project Goal & Overview + +Universal Enterprise Platform (UEP) is a modern, modular, multi-tenant enterprise application platform designed to provide secure, high-performance, and extensible business capabilities. + +Target capabilities include: +1. **Identity & Access Governance:** Multi-tenant user lifecycle, OIDC/PKCE authentication, and role-based access control (RBAC). +2. **Core Domain Services:** Modular domain business logic with strictly tenant-isolated data persistence. +3. **External Integrations:** Extensible adapter interfaces with deterministic Wave 0 sandboxes for offline CI validation. +4. **Multi-Portal Frontends:** Role-tailored web interfaces built on modern component design tokens (`DESIGN.md`). + +--- + +## 2. Active Technology Profile + +Derived authoritatively from [`tech-profile.yaml`](file:///home/ps-ub/w/din/h-lp5-v2/tech-profile.yaml): + +```yaml +stack: + architecture_pattern: "modular_monolith" + multi_tenancy: + enabled: true + model: "row_level_security" + backend: + language: "python" + framework: "fastapi" + orm: "sqlalchemy" + migrations: "alembic" + frontend: + framework: "react" + language: "typescript" + state_management: "zustand" + ui_library: "tailwind_shadcn" + authentication: + provider: "keycloak" + protocol: "oidc_pkce" + token_standard: "jwt_bearer" + authorization_model: "rbac_abac" + database: + primary: "postgresql" + cache_and_streams: "valkey" +``` + +--- + +## 3. Directory Layout & Traceability Spine + +``` +01_BRD/ # Business Requirements & PRD inputs +04_generated_documentation/ +├── 00_process_control/ # Master context, registers, decisions, checkpoints +├── 01_source_inventories/ # PRD / Feature extractions (BRD-FR-xxx) +├── 02_legacy_analysis/ # Brownfield legacy code, DB & screen mining +├── 03_requirements/use_cases/ # Atomic Use Cases (UC-xxx) & Functional Reqs (FR-xxx) +├── 04_architecture_design/ # HLD, LLD (API/Table/Event contracts), Spike Reports +├── 05_iteration_planning/ # Iteration backlogs, plans, and surface matrices +├── 06_wireframes/ # Screen specifications, wireframes, DESIGN.md +├── 07_test_design/ # Test strategies, Multi-path models, 21-sheet QA Workbooks +└── 08_review_ready_baselines/ # Stage 18 review-ready baselines and handover +``` + +--- + +## 4. Active Stage & Next Actions + +- **Current Stage:** Stage 0 Completed / Ready for Stage 1 Inception (`up-brd-extract`) & Stage 5 Elaboration (`up-use-case-author`). +- **Active Iteration:** `iteration-01` (Identity & User Management Slice). diff --git a/04_generated_documentation/00_process_control/traceability_graph.md b/04_generated_documentation/00_process_control/traceability_graph.md new file mode 100644 index 0000000..883639b --- /dev/null +++ b/04_generated_documentation/00_process_control/traceability_graph.md @@ -0,0 +1,60 @@ +# Master Traceability Graph + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.1) | +| **Document Path** | `04_generated_documentation/00_process_control/traceability_graph.md` | +| **Last Updated** | 2026-10-03 | +| **Gated By** | `up-traceability-gate`, `scripts/verify_traceability_gates.py` | + + +--- + +## 1. Graph Summary Statistics + +- **Total Use Cases (UC-xxx):** 1 +- **Total Functional Requirements (FR-xxx):** 3 +- **Total System Requirements (SRS / NFR):** 3 +- **Total User Stories (STORY-xxx):** 3 +- **Total Test Cases (TC-xxx):** 4 +- **Gate 5.1 Status:** **PASS** (Zero critical findings) +- **Gate 9.1 Status:** **PASS** (Zero critical findings) + +--- + +## 2. Active Node Hierarchy + +```mermaid +graph TD + BRD["BRD-FR-001 (User Auth & Access)"] --> UC001["UC-001 (User Identity & Role Governance)"] + UC001 --> FR001["FR-AUTH-001 (OIDC PKCE Login)"] + UC001 --> FR002["FR-AUTH-002 (Multi-Tenant RBAC)"] + UC001 --> FR003["FR-AUTH-003 (Session & Token Revocation)"] + + FR001 --> SRS001["SRS-AUTH-001 (JWT Claims & PKCE)"] + FR001 --> HLD001["HLD-AUTH / LLD-001"] + FR001 --> STORY001["STORY-AUTH-001"] + STORY001 --> TC001["TC-AUTH-001 (Happy Path OIDC)"] + STORY001 --> TC002["TC-AUTH-002 (Invalid Token Boundary)"] + + FR002 --> SRS002["SRS-AUTH-002 (Tenant RLS Scoping)"] + FR002 --> HLD001 + FR002 --> STORY002["STORY-AUTH-002"] + STORY002 --> TC003["TC-AUTH-003 (Cross-Tenant Rejection)"] + + FR003 --> SRS003["SRS-AUTH-003 (Session Blacklist)"] + FR003 --> HLD001 + FR003 --> STORY003["STORY-AUTH-003"] + STORY003 --> TC004["TC-AUTH-004 (Token Revocation FSM)"] +``` + +--- + +## 3. Node Traceability Table + +| Node ID | Node Name | Parent ID | Downstream Linkages | Status | +|---|---|---|---|---| +| `UC-001` | User Identity & Role Governance | `BRD-FR-001` | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | Baselined | +| `FR-AUTH-001` | OIDC PKCE Login | `UC-001` | `SRS-AUTH-001`, `LLD-001_auth_service.md`, `STORY-AUTH-001` | Ready for Construction | +| `FR-AUTH-002` | Multi-Tenant RBAC | `UC-001` | `SRS-AUTH-002`, `LLD-001_auth_service.md`, `STORY-AUTH-002` | Ready for Construction | +| `FR-AUTH-003` | Session & Token Revocation | `UC-001` | `SRS-AUTH-003`, `LLD-001_auth_service.md`, `STORY-AUTH-003` | Ready for Construction | diff --git a/04_generated_documentation/00_process_control/traceability_index.md b/04_generated_documentation/00_process_control/traceability_index.md new file mode 100644 index 0000000..351d475 --- /dev/null +++ b/04_generated_documentation/00_process_control/traceability_index.md @@ -0,0 +1,25 @@ +# Requirements & Traceability Index + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/traceability_index.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## 1. Single Traceability Chain + +Every requirement, design artifact, user story, and test case follows strict forward and backward traceability: + +$$\text{BRD-FR-xxx} \longrightarrow \text{UC-xxx} \longrightarrow \text{FR-xxx} \longrightarrow \begin{cases} \text{SRS-xxx / NFR-xxx} \\ \text{HLD / LLD} \\ \text{STORY-xxx} \longrightarrow \text{TC-xxx} \end{cases}$$ + +--- + +## 2. Master Traceability Register + +| Trace ID | Requirement Name | Actor(s) | BRD Feature | UC ID | FR ID(s) | HLD / LLD Component | Delivery Stories | Test Cases | Delivery Status | +|---|---|---|---|---|---|---|---|---|---| +| `TR-001` | User Authentication & OIDC PKCE | All Users | `BRD-FR-001` | `UC-001` | `FR-AUTH-001` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-001` | `TC-AUTH-001`, `TC-AUTH-002` | Ready for Construction | +| `TR-002` | Multi-Tenant RBAC Authorization | Admin, User | `BRD-FR-002` | `UC-001` | `FR-AUTH-002` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-002` | `TC-AUTH-003` | Ready for Construction | +| `TR-003` | User Session Lifecycle & Revocation | All Users | `BRD-FR-003` | `UC-001` | `FR-AUTH-003` | `HLD-AUTH` / `LLD-001_auth_service.md` | `STORY-AUTH-003` | `TC-AUTH-004` | Ready for Construction | diff --git a/04_generated_documentation/00_process_control/vocabulary_glossary.md b/04_generated_documentation/00_process_control/vocabulary_glossary.md new file mode 100644 index 0000000..d4e915b --- /dev/null +++ b/04_generated_documentation/00_process_control/vocabulary_glossary.md @@ -0,0 +1,20 @@ +# Vocabulary & Glossary + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/00_process_control/vocabulary_glossary.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## Universal Domain & Process Terminology + +| Term | Category | Definition | Source / Reference | +|---|---|---|---| +| **Tenant** | Identity / Architecture | An isolated organizational unit with its own data boundaries, users, roles, and configuration. | `tech-profile.yaml` | +| **Row-Level Security (RLS)** | Database / Security | PostgreSQL security mechanism ensuring queries only return rows belonging to the active tenant session. | `tech-profile.yaml` | +| **Wave 0 Sandbox** | Testing / Integration | Deterministic local mock adapter under `app/integrations/sandbox/` providing 100% offline, reproducible integration tests. | UP-AI v1.0 Standard | +| **Delivery Surface Matrix** | Construction / QA | 11-dimension delivery contract mapping every story across frontend, API, data, integration, and QA surfaces. | `iteration_surface_matrix.md` | +| **Multi-Path Testing** | Quality Assurance | Enforced testing across Happy Path, Alternate/Boundary, Negative/Failure, and FSM Invariant dimensions ($\ge 95\%$ coverage). | UP-AI v1.0 Standard | +| **Change Request (CR)** | Governance / Traceability | Formal entity computing blast-radius impact across the traceability graph before any requirement, design, or code is modified. | `up-change-request-impact` | diff --git a/04_generated_documentation/01_source_inventories/brd_inventory.md b/04_generated_documentation/01_source_inventories/brd_inventory.md new file mode 100644 index 0000000..c1b4651 --- /dev/null +++ b/04_generated_documentation/01_source_inventories/brd_inventory.md @@ -0,0 +1,19 @@ +# Business Requirements Document (BRD/PRD) Inventory + +| Field | Value | +|---|---| +| **Governed Standard** | SEI-CMMI Level 3 (UP-AI v1.0) | +| **Document Path** | `04_generated_documentation/01_source_inventories/brd_inventory.md` | +| **Source** | `01_BRD/PRD_Specification.template.md` | +| **Last Updated** | 2026-09-03 | + +--- + +## Extracted Business Features & Requirements (`BRD-FR-xxx`) + +| Feature ID | Feature Name | PRD Reference | Primary Actor | Description | Downstream Use Case | Status | +|---|---|---|---|---|---|---| +| `BRD-FR-001` | Multi-Tenant User Authentication | PRD §3 | All Users | Secure OIDC/PKCE login with tenant context propagation and JWT bearer token issuance. | `UC-001` | Extracted / Baselined | +| `BRD-FR-002` | Role-Based Access Control (RBAC) | PRD §3 | Tenant Admin | Tenant-scoped roles, permissions, and hierarchical privilege enforcement. | `UC-001` | Extracted / Baselined | +| `BRD-FR-003` | User Session & Token Revocation | PRD §3 | All Users | Session state monitoring, refresh token rotation, and instant revocation capability. | `UC-001` | Extracted / Baselined | +| `BRD-FR-004` | Audit & Compliance Event Stream | PRD §3 | System Admin | Immutable audit logging of authentication, state mutations, and administrative events. | `UC-001` | Extracted / Baselined | diff --git a/04_generated_documentation/02_legacy_analysis/.gitkeep b/04_generated_documentation/02_legacy_analysis/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md new file mode 100644 index 0000000..ad3a87c --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md @@ -0,0 +1,64 @@ +# Functional Requirements: UC-001 User Identity and Role Governance + +| Field | Value | +|---|---| +| **Parent Use Case** | [`UC-001`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Document** | `functional-reqs.md` | +| **Status** | Baselined | +| **Version** | 1.0.0 | +| **Last CR** | None (UP-AI v1.0 Baseline) | + +--- + +## FR-AUTH-001: Multi-Tenant OIDC PKCE Login + +- **Requirement ID:** `FR-AUTH-001` +- **Parent Use Case:** `UC-001` +- **Source Feature:** `BRD-FR-001` +- **Priority:** P0 (Must Have) +- **Primary Surface:** Frontend Portal Login Screen, Backend Auth Router + +### Statement +The platform shall provide secure multi-tenant user authentication via OpenID Connect (OIDC) Authorization Code Flow with Proof Key for Code Exchange (PKCE). Upon successful login, the system shall issue a signed JSON Web Token (JWT) containing standard claims (`sub`, `email`, `exp`) and custom claims (`tenant_id`, `roles`, `permissions`). + +### Acceptance Criteria +1. Unauthenticated users attempting to access protected routes shall be redirected to the OIDC provider login interface. +2. The authorization request MUST include a SHA-256 PKCE code challenge. +3. Access tokens MUST be signed with RS256 and have an expiration of $\le 15\text{ minutes}$. +4. All backend API endpoints MUST validate the token signature and verify the `tenant_id` claim. + +--- + +## FR-AUTH-002: Role-Based Access Control & RLS Scoping + +- **Requirement ID:** `FR-AUTH-002` +- **Parent Use Case:** `UC-001` +- **Source Feature:** `BRD-FR-002` +- **Priority:** P0 (Must Have) +- **Primary Surface:** Backend RBAC Middleware, PostgreSQL Database + +### Statement +The platform shall enforce granular Role-Based Access Control (RBAC) at the API route level and PostgreSQL Row-Level Security (RLS) at the database layer. For every authenticated request, the database session MUST have `app.current_tenant` initialized to prevent any cross-tenant query execution. + +### Acceptance Criteria +1. Routes decorated with role requirements (e.g. `@require_roles("admin")`) MUST reject requests lacking the required role with HTTP 403 Forbidden. +2. Direct SQL queries executed within a tenant session MUST NOT return or modify records belonging to other tenants. +3. Super-admin operations spanning multiple tenants MUST require explicit elevated scope claims. + +--- + +## FR-AUTH-003: Session Monitoring & Token Revocation + +- **Requirement ID:** `FR-AUTH-003` +- **Parent Use Case:** `UC-001` +- **Source Feature:** `BRD-FR-003` +- **Priority:** P1 (High) +- **Primary Surface:** Backend Auth Router, Token Cache + +### Statement +The platform shall support instant user logout and token revocation. Revoked tokens and compromised sessions MUST be added to a distributed blacklist (Valkey/Redis) checked during token validation. + +### Acceptance Criteria +1. Calling `/api/v1/auth/logout` with a valid refresh token MUST invalidate both access and refresh tokens. +2. Blacklisted tokens MUST be rejected immediately on subsequent API calls within $\le 500\text{ ms}$ of revocation. +3. An audit log entry (`AUDIT-AUTH-LOGOUT`) MUST be recorded with timestamp, user ID, and client IP. diff --git a/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md new file mode 100644 index 0000000..d16c1bb --- /dev/null +++ b/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md @@ -0,0 +1,67 @@ +# UC-001: User Identity and Role Governance + +| Field | Value | +|---|---| +| **Use Case ID** | `UC-001` | +| **Name** | User Identity and Role Governance | +| **Owning Domain** | Identity & Access Management (IAM) | +| **Primary Actor** | End User / Tenant Administrator | +| **Supporting Actors** | Keycloak OIDC Provider, PostgreSQL RLS Engine | +| **Parent Feature** | `BRD-FR-001`, `BRD-FR-002`, `BRD-FR-003` | +| **Status** | Baselined | +| **Version** | 1.0.0 | +| **Last CR** | None (UP-AI v1.0 Baseline) | + +--- + +## 1. Description & Business Goal + +This use case governs multi-tenant user authentication, token issuance, role-based authorization (RBAC), and session revocation across all web portals and API services. + +It guarantees that: +1. All client authentication requests execute via secure OIDC Authorization Code Flow with PKCE. +2. User sessions propagate verified `tenant_id` claims that bind database queries to the active tenant via PostgreSQL Row-Level Security (RLS). +3. Access tokens and refresh tokens follow strict rotation policies and can be revoked on demand. + +--- + +## 2. Preconditions + +1. The target tenant organization is active and configured in Keycloak. +2. The user has an active account with at least one assigned organizational role. +3. The client application (e.g. Admin Portal or Customer Portal) is a registered OIDC client. + +--- + +## 3. Main Success Scenario (Happy Path) + +1. **Initiate Authentication:** The user accesses the web application and clicks "Login". +2. **PKCE Challenge Generation:** The frontend client generates a cryptographic code verifier and code challenge, redirecting the browser to Keycloak's authorization endpoint. +3. **User Authentication:** The user enters credentials (username/password or enterprise SSO). Keycloak validates credentials and issues an authorization code. +4. **Token Exchange:** The frontend exchanges the authorization code and code verifier with Keycloak for a signed JWT access token, refresh token, and ID token containing `tenant_id` and `roles`. +5. **Session Establishment:** The frontend initializes application state with user claims and tenant context. +6. **API Invocation:** Subsequent API requests include the `Authorization: Bearer ` header. The backend gateway validates token signature, extracts tenant context, sets the PostgreSQL `app.current_tenant` session variable, and authorizes the endpoint via RBAC claims. + +--- + +## 4. Alternate & Exception Scenarios + +- **4a. Expired Access Token:** The frontend intercepts a 401 response and uses the refresh token to silently obtain a fresh access token without user friction. +- **4b. Invalid or Revoked Token:** If a token is blacklisted or revoked, the backend rejects the request with HTTP 401 `TOKEN_REVOKED`, and the frontend redirects to the login screen. +- **4c. Insufficient Role Permissions (RBAC):** If the user's role does not permit the requested operation, the backend returns HTTP 403 `FORBIDDEN` with a structured error response. +- **4d. Cross-Tenant Tampering:** If a request attempts to access data outside the token's `tenant_id`, PostgreSQL Row-Level Security silently filters or blocks the query, ensuring zero cross-tenant data leakage. + +--- + +## 5. Postconditions + +- A secure, verified session is established with tenant scoping. +- An immutable audit record (`AUDIT-AUTH-LOGIN`) is emitted. + +--- + +## 6. Child Functional Requirements + +- [`FR-AUTH-001: Multi-Tenant OIDC PKCE Login`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-001) +- [`FR-AUTH-002: Role-Based Access Control & RLS Scoping`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-002) +- [`FR-AUTH-003: Session Monitoring & Token Revocation`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/functional-reqs.md#fr-auth-003) diff --git a/04_generated_documentation/04_architecture_design/hld.md b/04_generated_documentation/04_architecture_design/hld.md new file mode 100644 index 0000000..c9434ec --- /dev/null +++ b/04_generated_documentation/04_architecture_design/hld.md @@ -0,0 +1,40 @@ +# High-Level Architecture Design (HLD) — Universal Enterprise Platform + +| Field | Value | +|---|---| +| **Document** | `hld.md` | +| **System** | Universal Enterprise Platform (UEP) | +| **Pattern** | Modular Monolith with Multi-Tenant Row-Level Security | +| **Version** | 1.0.0 | +| **Status** | Baselined (Elaboration Phase) | + +--- + +## 1. System Architecture Topology + +```mermaid +graph TD + ClientWeb["Web Portals (React + Vite + Tailwind)"] --> NGINX["API Gateway / Reverse Proxy (NGINX)"] + ClientMobile["Mobile Apps / External Consumers"] --> NGINX + + NGINX --> AuthFilter["Auth & Tenant Context Middleware"] + AuthFilter --> Keycloak["Identity Provider (Keycloak OIDC)"] + + subgraph Modular Monolith Core + AuthFilter --> ModAuth["IAM / Auth Module (LLD-001)"] + AuthFilter --> ModDomain["Core Business Modules"] + AuthFilter --> ModIntegration["Integration & Sandboxes"] + end + + ModAuth --> PG[("PostgreSQL DB (with RLS)")] + ModDomain --> PG + ModAuth --> Valkey[("Valkey / Redis (Token Blacklist & Cache)")] +``` + +--- + +## 2. Core Architectural Pillars + +1. **Multi-Tenancy via Row-Level Security:** Every domain table carries a `tenant_id` UUID column. When requests arrive, the Auth Middleware extracts `tenant_id` from the verified JWT and sets `SET LOCAL app.current_tenant = ''` on the database session connection pool. +2. **Deterministic Wave 0 Sandboxing:** All external third-party integrations (payment gateways, identity verification, SMS/email) implement an abstract adapter with a local deterministic mock under `app/integrations/sandbox/`. +3. **Pluggable Event Stream:** Inter-module communication executes via in-process domain event dispatchers that can scale out to message queues (RabbitMQ / Kafka) as needed. diff --git a/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md b/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md new file mode 100644 index 0000000..a374ca0 --- /dev/null +++ b/04_generated_documentation/04_architecture_design/lld/LLD-001_auth_service.md @@ -0,0 +1,68 @@ +# LLD-001: IAM & Authentication Service + +| Field | Value | +|---|---| +| **Document** | `LLD-001_auth_service.md` | +| **Component** | `HLD-AUTH` (Identity & Access Management) | +| **Parent Use Case** | [`UC-001`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Parent FRs** | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | +| **Status** | Baselined | +| **Version** | 1.0.0 | + +--- + +## 1. Component Boundaries & Endpoints + +### 1.1 API Router Endpoints (`/api/v1/auth`) + +| Method | Endpoint | Description | Auth Required | Request Body | Response Codes | +|---|---|---|---|---|---| +| `POST` | `/api/v1/auth/token` | Exchange authorization code & PKCE verifier for JWT tokens | No | `TokenExchangeRequest` | 200 OK, 400 Bad Request | +| `POST` | `/api/v1/auth/refresh` | Obtain fresh access token using valid refresh token | No | `RefreshTokenRequest` | 200 OK, 401 Unauthorized | +| `POST` | `/api/v1/auth/logout` | Revoke session & blacklist active refresh token | Yes | `LogoutRequest` | 200 OK, 401 Unauthorized | +| `GET` | `/api/v1/auth/me` | Return active user claims, roles, and tenant context | Yes | — | 200 OK, 401 Unauthorized | + +--- + +## 2. Database Schema (PostgreSQL with RLS) + +```sql +-- Core Tenants Table +CREATE TABLE tenants ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + code VARCHAR(32) NOT NULL UNIQUE, + name VARCHAR(255) NOT NULL, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +-- Users Table (Tenant-Scoped) +CREATE TABLE users ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE, + email VARCHAR(255) NOT NULL, + full_name VARCHAR(255) NOT NULL, + is_active BOOLEAN NOT NULL DEFAULT true, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + CONSTRAINT uq_tenant_user_email UNIQUE (tenant_id, email) +); + +-- Enable Row-Level Security on Users +ALTER TABLE users ENABLE ROW LEVEL SECURITY; + +CREATE POLICY tenant_isolation_policy ON users + AS RESTRICTIVE + USING (tenant_id = current_setting('app.current_tenant', true)::uuid); +``` + +--- + +## 3. Middleware & Security Context Propagation + +The FastAPI dependency `get_current_user` extracts the JWT Bearer token: +1. Validates signature with Keycloak JWKS public keys. +2. Asserts token is not listed in Valkey blacklist (`blacklist:token:`). +3. Extracts `tenant_id` and sets PostgreSQL session context: + ```python + await db_session.execute(text("SET LOCAL app.current_tenant = :t_id"), {"t_id": str(user.tenant_id)}) + ``` diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md new file mode 100644 index 0000000..d02342c --- /dev/null +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_backlog.md @@ -0,0 +1,17 @@ +# Iteration Backlog — Iteration 01 + +| Field | Value | +|---|---| +| **Iteration** | `iteration-01` | +| **Parent Use Case** | [`UC-001`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Status** | Ready for Construction | + +--- + +## Story Backlog + +| Story ID | Parent FR | Story Title | Points | Priority | Primary Delivery Surface | Assigned Roles | Status | +|---|---|---|---|---|---|---|---| +| `STORY-AUTH-001` | `FR-AUTH-001` | OIDC PKCE Authorization Code Exchange | 5 | P0 | Backend API (`/api/v1/auth/token`), Frontend `/login` | `@backend-dev`, `@ui-designer-dev` | Ready | +| `STORY-AUTH-002` | `FR-AUTH-002` | Tenant Context Propagation & PostgreSQL RLS | 5 | P0 | Middleware, Database Migrations | `@backend-dev` | Ready | +| `STORY-AUTH-003` | `FR-AUTH-003` | Session Monitoring, Token Blacklist & Logout | 3 | P1 | Backend API (`/api/v1/auth/logout`), Cache (Valkey) | `@backend-dev`, `@adversarial-tester` | Ready | diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md new file mode 100644 index 0000000..8cff6a2 --- /dev/null +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_plan.md @@ -0,0 +1,20 @@ +# Iteration Plan — Iteration 01 (IAM & Multi-Tenant Core) + +| Field | Value | +|---|---| +| **Iteration** | `iteration-01` | +| **Slice Goal** | Deliver end-to-end multi-tenant OIDC login, RBAC authorization, and session lifecycle (`UC-001`). | +| **Governed Standard** | UP-AI v1.0 Stage 10 Standard | +| **Capacity** | 3 Stories (13 Story Points) | +| **Status** | Approved for Construction | + +--- + +## 1. Demo & Acceptance Criteria + +At the conclusion of Iteration 01, the team will demonstrate: +1. An unauthenticated user accessing `/` is redirected to Keycloak OIDC login and returns with valid session tokens. +2. A Tenant Admin logging in accesses `/admin/roles` and sees tenant-scoped RBAC management with PostgreSQL RLS active. +3. Logging out from the profile menu invalidates the active session and blacklists the token across subsequent API calls. +4. Multi-path automated test suite achieves $\ge 95.0\%$ coverage via `scripts/run_tests.sh --scope iteration-01`. +5. 21-sheet Excel Manual QA Workbook is compiled and verified under `07_test_design/manual_qa/workbooks/`. diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md new file mode 100644 index 0000000..8f00eb7 --- /dev/null +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/iteration_surface_matrix.md @@ -0,0 +1,17 @@ +# Iteration Delivery Surface Matrix — Iteration 01 + +| Field | Value | +|---|---| +| **Iteration** | `iteration-01` | +| **Governed Standard** | UP-AI v1.0 Standard | +| **Status** | Verified for Gate 14.1 | + +--- + +## 11-Dimension Delivery Surface Coverage + +| Story ID | Parent FR | Portal / Screen | Route | API Endpoint | DB Migration | Sandbox / Mock | Config / Secret | Test Scopes | Dev Owner | QA Owner | Surface Status | +|---|---|---|---|---|---|---|---|---|---|---|---| +| `STORY-AUTH-001` | `FR-AUTH-001` | Auth Portal / Login | `/login` | `POST /api/v1/auth/token` | Alembic `001_auth_core.py` | `sandbox/identity_mock.py` | `KEYCLOAK_URL` | Unit, Bruno, Playwright | `@backend-dev` | `@adversarial-tester` | Specified | +| `STORY-AUTH-002` | `FR-AUTH-002` | Admin Portal / Roles | `/admin/roles` | `GET /api/v1/auth/me` | Alembic `002_rls_policies.py` | N/A (Internal DB) | `DATABASE_URL` | Unit, Integration RLS | `@backend-dev` | `@adversarial-tester` | Specified | +| `STORY-AUTH-003` | `FR-AUTH-003` | User Settings / Sessions | `/account/sessions` | `POST /api/v1/auth/logout` | None (Valkey keys) | N/A (Internal Cache) | `VALKEY_URL` | Unit, FSM Invariant | `@backend-dev` | `@adversarial-tester` | Specified | diff --git a/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md new file mode 100644 index 0000000..95cce06 --- /dev/null +++ b/04_generated_documentation/05_iteration_planning/iterations/iteration-01/parallel_work_plan.md @@ -0,0 +1,29 @@ +# Parallel Work & Lane Isolation Plan — Iteration 01 + +| Field | Value | +|---|---| +| **Iteration** | `iteration-01` | +| **Governed Standard** | UP-AI v1.0 Standard | +| **Integration Skill** | `up-parallel-work-integrate` | +| **Status** | Approved | + +--- + +## Lane Allocations + +### Lane 1: Backend Auth Service & Database RLS (`lane/backend-auth`) +- **Assigned Stories:** `STORY-AUTH-001`, `STORY-AUTH-002`, `STORY-AUTH-003` +- **Owner:** `@backend-dev` +- **Allowed Scope:** Backend FastAPI routers, Alembic migrations, SQLAlchemy models, test fixtures. +- **Wave 0 Sandboxes:** `sandbox/identity_mock.py` + +### Lane 2: Frontend Auth Views & Token Interceptor (`lane/frontend-auth`) +- **Assigned Stories:** `STORY-AUTH-001` (UI surface) +- **Owner:** `@ui-designer-dev` +- **Allowed Scope:** React portal views (`/login`, `/account/sessions`), OIDC PKCE client interceptor, Playwright E2E specs. + +--- + +## Safe Convergence & Merge Order +1. **Merge Order:** `lane/backend-auth` $\longrightarrow$ `lane/frontend-auth` $\longrightarrow$ `master-lane`. +2. **Integration Gate:** Run `/up-parallel-work-integrate lane/backend-auth lane/frontend-auth` prior to Gate 14.1. diff --git a/04_generated_documentation/06_wireframes/DESIGN.md b/04_generated_documentation/06_wireframes/DESIGN.md new file mode 100644 index 0000000..d65c32e --- /dev/null +++ b/04_generated_documentation/06_wireframes/DESIGN.md @@ -0,0 +1,78 @@ +# Frontend Design Guideline & Component Standard + +| Field | Value | +|---|---| +| **Document** | `DESIGN.md` | +| **System** | Universal Enterprise Platform (UEP) | +| **Governed by** | UP-AI v1.0 Stage 11 Design Standard | +| **Status** | Baselined | +| **Scope** | Cross-portal frontend design & component guideline for Stage 11 (`up-wireframe-spec`) and Stage 13 (`up-code-generate`) | + +--- + +## 0. Purpose + +This document establishes the universal design tokens, layout shells, screen archetypes, and component composition rules across all frontend portals in the platform. + +It eliminates UI drift and guarantees that: +1. All screens compose from standardized design system primitives (Radix UI / shadcn / Tailwind CSS). +2. Wireframe screen shapes map deterministically to component patterns. +3. Common cross-portal behaviors (OIDC redirect, RBAC menu filtering, toast notifications, error handling) are implemented consistently. + +--- + +## 1. Design System Foundation & Tokens + +### 1.1 Technology Stack +- **Framework:** React 19 + TypeScript + Vite +- **Styling:** Tailwind CSS v4 with CSS-first custom tokens +- **Component Primitives:** Radix UI / shadcn/ui (`class-variance-authority`) +- **Icons:** `lucide-react` +- **Charts:** `recharts` / shadcn chart wrapper + +### 1.2 Core Color & Semantic Tokens (`index.css`) + +| Token | HSL / Value | Semantic Purpose | +|---|---|---| +| `--primary` | `hsl(221, 83%, 53%)` | Primary brand action, active navigation, focus rings | +| `--background` | `hsl(0, 0%, 100%)` / `hsl(222, 47%, 11%)` | Canvas background (Light / Dark mode) | +| `--card` | `hsl(0, 0%, 100%)` / `hsl(217, 33%, 17%)` | Surface container for table/form/metric cards | +| `--success` | `hsl(142, 76%, 36%)` | Active, Confirmed, Delivered, Resolved states | +| `--warning` | `hsl(38, 92%, 50%)` | Pending, In-Progress, Expiring-Soon states | +| `--destructive` | `hsl(0, 84%, 60%)` | Failed, Rejected, Cancelled, Overdue states | +| `--info` | `hsl(199, 89%, 48%)` | Informational, Draft, Awaiting-Approval states | + +--- + +## 2. Universal Layout Shell (`MainLayout.tsx`) + +Every authenticated portal route runs under a standard layout shell: +``` ++-------------------------------------------------------------------------+ +| [Logo] Tenant Name [Search / Quick Actions] [User Avatar] | <-- Header ++-------------------+-----------------------------------------------------+ +| Navigation: | | +| - Dashboard | Breadcrumbs / PageHeader(Title, Actions) | +| - Management | | +| - Settings | [Routed Page Content: Table / Form / Dashboard] | +| - Audit Logs | | +| | | ++-------------------+-----------------------------------------------------+ +| [Collapse Sidebar]| Global Toaster | ++-------------------+-----------------------------------------------------+ +``` + +- **Route Guarding:** Unauthenticated state immediately triggers OIDC redirect to Keycloak. +- **RBAC Filtering:** Sidebar items and action buttons evaluate user role claims before rendering. + +--- + +## 3. Seven Screen Archetypes → Component Mapping + +1. **List / Table + Filters:** `Card` + `FilterBar` + `Table` + `Pagination` + row action `DropdownMenu`. +2. **Dashboard / Metrics:** `MetricCard` (KPI tiles) + `Chart` (Recharts) + `ActivityFeed`. +3. **Multi-Step Form / Wizard:** `Stepper` + `Form` (React Hook Form + Zod) + `ButtonGroup`. +4. **Detail / Split-Panel View:** `PageHeader` + `Tabs` (Overview, History, Permissions, Audit). +5. **Modal / Action Dialog:** `Dialog` / `AlertDialog` (one dialog per distinct row action). +6. **Live Telemetry / Stream:** Map canvas or event stream + collapsible filter drawer + status legend. +7. **Error / Empty State:** `EmptyStateCard` with descriptive icon, friendly title, and primary recovery action button. diff --git a/04_generated_documentation/06_wireframes/wireframe_index.md b/04_generated_documentation/06_wireframes/wireframe_index.md new file mode 100644 index 0000000..5e468d6 --- /dev/null +++ b/04_generated_documentation/06_wireframes/wireframe_index.md @@ -0,0 +1,18 @@ +# Wireframe & Screen Specification Index + +| Field | Value | +|---|---| +| **Document** | `wireframe_index.md` | +| **System** | Universal Enterprise Platform (UEP) | +| **Governed Standard** | UP-AI v1.0 Stage 11 Standard | +| **Last Updated** | 2026-09-03 | + +--- + +## Screen Inventory + +| Screen ID | Screen Title | Route Path | Target Actor / Role | Screen Archetype | Owning UC / FR | Iteration | +|---|---|---|---|---|---|---| +| `SCR-AUTH-001` | Enterprise Login & Tenant Selector | `/login` | Public / All | Form / Modal | `UC-001` / `FR-AUTH-001` | `iteration-01` | +| `SCR-AUTH-002` | User Profile & Active Sessions | `/account/sessions` | All Authenticated | Detail / Table | `UC-001` / `FR-AUTH-003` | `iteration-01` | +| `SCR-ADMIN-001` | Tenant Role & Access Governance | `/admin/roles` | Tenant Admin | List / Table + Filters | `UC-001` / `FR-AUTH-002` | `iteration-01` | diff --git a/04_generated_documentation/07_test_design/functional_test_cases/TC-001_auth_service.md b/04_generated_documentation/07_test_design/functional_test_cases/TC-001_auth_service.md new file mode 100644 index 0000000..1197ca1 --- /dev/null +++ b/04_generated_documentation/07_test_design/functional_test_cases/TC-001_auth_service.md @@ -0,0 +1,60 @@ +# Functional Test Cases: UC-001 User Identity and Role Governance + +| Field | Value | +|---|---| +| **Test Suite** | `TC-001_auth_service.md` | +| **Parent Use Case** | [`UC-001`](file:///home/ps-ub/w/din/h-lp5-v2/04_generated_documentation/03_requirements/use_cases/uc-001_user-authentication/use-case.md) | +| **Parent FRs** | `FR-AUTH-001`, `FR-AUTH-002`, `FR-AUTH-003` | +| **Status** | Baselined | + +--- + +## TC-AUTH-001: OIDC PKCE Authorization Code Exchange (Happy Path) + +- **ID:** `TC-AUTH-001` +- **Category:** Functional / Happy Path +- **Priority:** P0 +- **Preconditions:** Keycloak is running; test tenant `tenant-alpha` and user `alice@alpha.com` exist. +- **Steps:** + 1. Generate SHA-256 PKCE code verifier and challenge. + 2. Perform authorization code redirect with `tenant_id=tenant-alpha`. + 3. Exchange authorization code and code verifier at `/api/v1/auth/token`. +- **Expected Result:** HTTP 200 OK returned with valid JWT access token containing `tenant_id: tenant-alpha` and valid RS256 signature. + +--- + +## TC-AUTH-002: Rejection of Expired JWT Access Token (Boundary) + +- **ID:** `TC-AUTH-002` +- **Category:** Boundary / Security +- **Priority:** P0 +- **Preconditions:** An access token created with `exp` in the past. +- **Steps:** + 1. Send request to protected endpoint `GET /api/v1/auth/me` with expired token. +- **Expected Result:** HTTP 401 Unauthorized returned with error code `TOKEN_EXPIRED`. + +--- + +## TC-AUTH-003: Row-Level Security Isolation Guard (Negative / Security) + +- **ID:** `TC-AUTH-003` +- **Category:** Security / Data Isolation +- **Priority:** P0 +- **Preconditions:** User `bob` belongs to `tenant-beta`; User `alice` belongs to `tenant-alpha`. +- **Steps:** + 1. Authenticate as `bob@beta.com`. + 2. Attempt to query user record for `alice@alpha.com`. +- **Expected Result:** Query returns 0 records (filtered by PostgreSQL RLS); no error or cross-tenant data leak. + +--- + +## TC-AUTH-004: Instant Session Revocation on Logout (FSM Invariant) + +- **ID:** `TC-AUTH-004` +- **Category:** FSM Invariant +- **Priority:** P1 +- **Preconditions:** Active valid access and refresh token pair. +- **Steps:** + 1. Call `POST /api/v1/auth/logout` with active refresh token. + 2. Attempt subsequent API call with previously issued access token. +- **Expected Result:** Logout returns HTTP 200; subsequent API call is immediately rejected with HTTP 401 `TOKEN_REVOKED`. diff --git a/04_generated_documentation/07_test_design/manual_qa/iteration-01/MANUAL_TESTING_GUIDE.md b/04_generated_documentation/07_test_design/manual_qa/iteration-01/MANUAL_TESTING_GUIDE.md new file mode 100644 index 0000000..88705eb --- /dev/null +++ b/04_generated_documentation/07_test_design/manual_qa/iteration-01/MANUAL_TESTING_GUIDE.md @@ -0,0 +1,41 @@ +# Manual Testing Guide — Iteration 01 (IAM & Access Control) + +| Field | Value | +|---|---| +| **Iteration** | Iteration 01 | +| **Scope Slice** | User Identity, Authentication, and RBAC Governance (`UC-001`) | +| **Governed Standard** | UP-AI v1.0 Dual Manual QA Standard | +| **Status** | Verified / Ready for Execution | + +--- + +## 1. Test Environment Setup & Disposable Personas + +### Preconditions +- Staging / Dev environment active with Keycloak identity realm seeded. +- Test personas configured: + - **Persona 1 (Tenant Admin):** `admin@enterprise-demo.com` (Role: `admin`) + - **Persona 2 (End User):** `user@enterprise-demo.com` (Role: `user`) + - **Persona 3 (Cross-Tenant Intruder):** `intruder@other-tenant.com` (Tenant: `other-tenant`) + +--- + +## 2. Manual Test Procedures + +### Procedure 1: Multi-Tenant Login & Token Validation +1. Open web browser to portal URL. +2. Click "Login with Enterprise SSO". +3. Verify redirection to Keycloak login screen with PKCE parameters in URL query. +4. Authenticate as `admin@enterprise-demo.com`. +5. Verify successful redirection back to portal dashboard with tenant name displayed in header. + +### Procedure 2: RBAC Access Guard Verification +1. Log in as `user@enterprise-demo.com` (non-admin). +2. Attempt to navigate directly to `/admin/tenant-settings`. +3. Verify access is denied with a 403 Forbidden alert and clean user-facing guidance. + +### Procedure 3: Token Revocation & Logout +1. Click user avatar and select "Sign Out". +2. Confirm session termination message. +3. Click browser back button and attempt to refresh page. +4. Verify user is prompted to re-authenticate. diff --git a/04_generated_documentation/07_test_design/manual_qa/workbooks/.gitkeep b/04_generated_documentation/07_test_design/manual_qa/workbooks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/04_generated_documentation/07_test_design/regression_test_cases.md b/04_generated_documentation/07_test_design/regression_test_cases.md new file mode 100644 index 0000000..6ae5634 --- /dev/null +++ b/04_generated_documentation/07_test_design/regression_test_cases.md @@ -0,0 +1,19 @@ +# Regression Test Suite Index + +| Field | Value | +|---|---| +| **Document** | `regression_test_cases.md` | +| **Governed Standard** | UP-AI v1.0 Quality Standard | +| **Scope Runner** | `scripts/run_tests.sh --scope ` | +| **Last Updated** | 2026-09-03 | + +--- + +## Master Regression Suite Catalog + +| Test Case ID | Test Category | Target FR | Automation Type | Physical Path / Collection | Tags | Status | +|---|---|---|---|---|---|---| +| `TC-AUTH-001` | Functional / Happy Path | `FR-AUTH-001` | Automated (pytest) | `tests/backend/test_auth_oidc.py` | `uc_001`, `fr_auth_001`, `iteration_01` | Active | +| `TC-AUTH-002` | Boundary / Token Expiry | `FR-AUTH-001` | Automated (pytest) | `tests/backend/test_auth_oidc.py` | `uc_001`, `fr_auth_001`, `iteration_01` | Active | +| `TC-AUTH-003` | Security / Cross-Tenant RLS | `FR-AUTH-002` | Automated (pytest) | `tests/backend/test_tenant_rls.py` | `uc_001`, `fr_auth_002`, `iteration_01` | Active | +| `TC-AUTH-004` | FSM / Token Revocation | `FR-AUTH-003` | Automated (pytest) | `tests/backend/test_auth_revocation.py` | `uc_001`, `fr_auth_003`, `iteration_01` | Active | diff --git a/04_generated_documentation/07_test_design/test_strategy.md b/04_generated_documentation/07_test_design/test_strategy.md new file mode 100644 index 0000000..c8054cd --- /dev/null +++ b/04_generated_documentation/07_test_design/test_strategy.md @@ -0,0 +1,30 @@ +# Master Test Strategy — Universal Enterprise Platform + +| Field | Value | +|---|---| +| **Document** | `test_strategy.md` | +| **System** | Universal Enterprise Platform (UEP) | +| **Governed Standard** | UP-AI v1.0 Quality Standard | +| **Status** | Baselined | + +--- + +## 1. Test Levels & Multi-Path Dimensions + +Testing in UP-AI v1.0 is strictly enforced across four multi-path dimensions to achieve **$\ge 95.0\%$ automated statement and branch coverage**: + +1. **Happy Path:** Expected standard execution flows and state progressions. +2. **Alternate & Boundary/Edge Cases:** Extreme values, empty states, pagination boundaries, and concurrency edges. +3. **Negative & Validation Failures:** Malformed payloads, invalid claims, expired tokens, and SQL injection probes. +4. **FSM Invariants & Idempotency:** State transition validation, token revocation immediacy, and cross-tenant leakage prevention. + +--- + +## 2. Test Types & Tooling Standard + +| Level / Type | Primary Framework | Artifact Location | Tagging Convention | +|---|---|---|---| +| **Backend Unit & Integration** | `pytest` + `pytest-cov` | `tests/backend/` | `uc_001`, `fr_auth_001`, `story_auth_001` | +| **API Contract & Integration** | Bruno (`.bru` plain text) | `docs/api/bruno/` | `@UC-001`, `@FR-AUTH-001` | +| **Frontend Component & E2E** | `vitest` + `playwright` | `tests/frontend/` | `@UC-001`, `@FR-AUTH-001` | +| **Manual QA Deliverables** | Markdown + Excel 21-Sheet | `07_test_design/manual_qa/` | `scripts/generate_manual_qa_workbook.py` | diff --git a/04_generated_documentation/08_review_ready_baselines/.gitkeep b/04_generated_documentation/08_review_ready_baselines/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..74b1166 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,71 @@ +# Repository Agent Guide — UP-AI v1.0 + +## Purpose + +This repository defines and applies the universal AI-Native Unified Process (**UP-AI v1.0 Generic Framework**). Keep work use-case-driven, architecture-centric, iterative, traceable, and resumable. + +## Read Efficiently + +Read only what the task requires. Use this source-of-truth order: + +1. `README.md` for repository orientation and developer workflow. +2. `00_prompts/AI_Native_Unified_Process_v1.md` for authoritative process, stages, gates, and artifact rules. +3. `00_prompts/02_Skills_Usage_Guide.md` for stage order and skill invocation. +4. `.agents/skills//SKILL.md` for the canonical procedure of an applicable skill. +5. `04_generated_documentation/00_process_control/` for current decisions, assumptions, ambiguities, change requests, traceability, and checkpoints. + +**Single Canonical Skills Location:** All AI agent skills are canonical and located under `.agents/skills//SKILL.md`. All AI agent platforms (Antigravity, Claude Code, Cursor, Codex) read directly from `.agents/skills/` without file duplication or synchronization scripts. + +## Working Rules + +- Inspect relevant artifacts and current repository state before editing; do not infer current scope from old prompts or stale plans. +- Preserve established IDs, metadata, document structure, cross-references, and traceability links. +- Follow the strict chronological folder structure under `04_generated_documentation/` (`00_process_control` through `08_review_ready_baselines`). +- Make the smallest complete change. Do not regenerate unaffected documents or silently expand scope. +- Do not invent missing business behavior. Record unresolved questions in the ambiguity register and request a decision. +- Before changing baselined requirements, architecture, scope, or NFRs, invoke `up-change-request-impact`; perform impact analysis and obtain the required disposition before editing affected artifacts. +- Use `up-process-change` for changes to this process, its gates, formats, or skills. +- Run the applicable `up-traceability-gate` at Gate 5.1, Gate 9.1, and each iteration's Gate 14.1. Do not treat scope as delivered while critical gate findings remain. +- Use `up-context-checkpoint` before a long pause, handoff, context exhaustion, or unresolved human decision. On continuation, verify the latest relevant checkpoint against repository state before relying on it. +- Never overwrite or revert unrelated work. Never commit, push, or alter git history unless explicitly requested. +- Verify changed code with the narrowest relevant tests first, then broader checks when warranted (`scripts/run_tests.sh --scope `). Report commands run and any checks not run. + +## Session Transcript (Required) + +Every AI-assisted conversation that performs work in this repository MUST maintain one running transcript in `prompts/`. The primary agent owns the file for the entire conversation, including activity delegated to subagents. + +### Start And Naming + +- At the first actionable request, create `prompts/YYYYMMDDTHHMMSSZ-session-.md` using the session start time in UTC. +- Use only lowercase ASCII letters, digits, and hyphens in ``. +- If the name already exists, append `-02`, `-03`, and so on. Never overwrite a prior transcript. +- Reuse that same file for all subsequent turns in the conversation. Do not create a file per turn or per subagent. +- Leave existing non-session files in `prompts/` unchanged. + +### Record + +Append entries in chronological order with an ISO 8601 UTC timestamp and speaker or agent label. Record: + +- Each user prompt, preserving its substance and wording after redaction. +- Each substantive assistant response, or a faithful concise summary when the response mainly contains generated content already saved in the repository. +- Decisions, assumptions, clarifications, blockers, and requested approvals. +- A concise action summary listing files created/changed and verification outcomes. +- For every subagent: its agent label, delegated prompt, and returned response or faithful result summary. + +### Exclude And Protect + +- Do not record hidden reasoning, chain-of-thought, internal scratch work, raw tool protocol, large command output, dependency logs, generated binaries, or full code diffs. +- Prefer a concise summary plus repository path for large generated content. Include small snippets only when needed to understand a decision. +- Redact secrets, credentials, access tokens, private keys, session cookies, personal data, and sensitive customer data as `[REDACTED]`. Do not persist a secret merely because it appeared in a prompt or tool result. +- Transcript logging complements process checkpoints; it does not replace `up-context-checkpoint` or governance registers. +- Update the transcript during the session and ensure the latest user request, response, actions, and subagent results are present before ending or handing off. + +## Completion + +Before reporting completion: + +1. Confirm the requested artifacts or code changes exist and are internally consistent. +2. Run applicable tests, validation, and traceability gates. +3. Update governance records or checkpoints when the process requires them. +4. Update the session transcript without embedding full diffs or sensitive data. +5. Summarize changed files, verification, open risks, and any required user decision. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3ba79d0 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,2 @@ +Please pickup instructions from AGENTS.md. +All AI agent skills are canonical and located under `.agents/skills//SKILL.md`. diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 0000000..3ba79d0 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,2 @@ +Please pickup instructions from AGENTS.md. +All AI agent skills are canonical and located under `.agents/skills//SKILL.md`. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a523519 --- /dev/null +++ b/README.md @@ -0,0 +1,227 @@ +# AI-Native Unified Process (UP-AI v1.1) — Universal Framework + +[![Process Version](https://img.shields.io/badge/Process-UP--AI%20v1.1%20Generic-blue.svg)](00_prompts/AI_Native_Unified_Process_v1.md) +[![Quality Standard](https://img.shields.io/badge/SEI--CMMI-Level%203%20Governed-green.svg)](00_prompts/AI_Native_Unified_Process_v1.md) +[![Automated Coverage](https://img.shields.io/badge/Test%20Coverage-Tiered%20%E2%89%A595%2F90%2F80%25-brightgreen.svg)](00_prompts/AI_Native_Unified_Process_v1.md) +[![Agent Skills](https://img.shields.io/badge/Skills-18%20Canonical%20Skills-orange.svg)](.agents/skills/) + +**UP-AI v1.1** is an enterprise-grade, stack-agnostic software engineering framework combining the rigor of the **Unified Process (UP)** and **SEI-CMMI Level 3** governance with the speed of **AI-Native pair programming and autonomous multi-agent orchestration**. + +It governs software delivery from business requirements (PRD/BRD) through architectural risk spikes, iterative construction, tiered multi-path test generation, 21-sheet QA workbook compilation, and UAT acceptance. + +--- + +## Key Architecture & Philosophy + +``` ++-----------------------------------------------------------------------------------+ +| PROJECT ARCHETYPE SELECTION | +| (via tech-profile.yaml) | ++-----------------------------------------------------------------------------------+ + | + +---> GREENFIELD TRACK (0-to-1 Build): + | Stage 0 (Bootstrap) -> Stage 1 (PRD Feature Extraction) -> Stage 1B (Domain Model) + | -> Stage 6 (Arch Risk Spike) -> Stage 7 (Walking Skeleton) -> Stage 5 (Use Cases) + | + +---> BROWNFIELD TRACK (Legacy Modernization / Migration): + Stage 0 (Bootstrap) -> Stage 1 (BRD Target Scope) -> Stage 2 (AST & API Mining) + -> Stage 3 (DB Schema & UI Mining) -> Stage 4 (Parity Gap Matrix) -> Stage 5 (Use Cases) + | + v ++-----------------------------------------------------------------------------------+ +| ELABORATION PHASE: | +| Gate 5.1 (UC-FR Gate) -> Stage 8 (SRS Derivation) -> Stage 9 (HLD/LLD) -> Gate 9.1| ++-----------------------------------------------------------------------------------+ + | + v ++-----------------------------------------------------------------------------------+ +| ITERATIVE CONSTRUCTION LOOP (Repeats per Vertical Feature Slice): | +| Stage 10 (Plan & Surface Matrix) -> Stage 11 (Wireframes & Screen Specs) | +| -> Stage 12 (Test Model, Bruno, 21-Sheet QA Workbook) | +| -> Stage 13 (Wave-Based Code Gen: Backend + Frontend + Migrations + Sandboxes) | +| -> Stage 14 (Code Review, Defect Triage & Gate 14.1 Definition-of-Done) | ++-----------------------------------------------------------------------------------+ + | + v ++-----------------------------------------------------------------------------------+ +| TRANSITION PHASE: Stage 15 (CI/CD) -> Stage 16 (UAT) -> Stage 17 (Client Handover)| +| -> Stage 18 (Review-Ready Baselines) | ++-----------------------------------------------------------------------------------+ +``` + +--- + +## The 8 Non-Negotiable UP-AI Principles + +1. **Dual-Track Inception Routing:** Greenfield projects bypass legacy discovery (Stages 2–4) directly to PRD modeling and risk spikes; Brownfield projects perform automated AST code mining, database schema reconstruction, and visual UI discovery. +2. **Atomic Use Case Requirements Spine:** Requirements are authored *inside* their owning use case (`UC-xxx` $\rightarrow$ `FR-xxx`), preventing orphaned specifications. +3. **Continuous Deterministic Quality Gates:** Hard-blocking gates (Gate 5.1, Gate 9.1, Gate 14.1) validate graph completeness deterministically via `scripts/verify_traceability_gates.py` before stage transitions. +4. **First-Class Change Request (CR) Lifecycle:** Scope changes, requirement gaps, and NFR shifts compute blast-radius impact graphs *before* documents or code are modified (`up-change-request-impact`). +5. **Risk-Driven Architecture Spikes:** Disposable walking skeletons validate high-risk architectural bottlenecks (data isolation, concurrency, external integrations) before full-scale construction. +6. **Wave 0 Deterministic Sandboxing:** External dependencies MUST provide local, deterministic sandbox adapters under `app/integrations/sandbox/` to guarantee 100% offline, reproducible CI execution. +7. **Differentiated Automated Test Coverage Budgets:** Enforces multi-path automated testing across Happy Path, Alternate/Boundary, Negative/Failure, and FSM Invariant dimensions with tiered thresholds ($\ge 95\%$ core domain/FSMs, $\ge 90\%$ integration adapters, $\ge 80\%$ UI components + Playwright E2E). +8. **Dual Manual QA Deliverables:** Every iteration produces both a Markdown testing guide and a 30-column, 21-sheet Excel Manual QA Workbook (`.xlsx`) via deterministic compiler tooling (`scripts/generate_manual_qa_workbook.py`). + +--- + +## Declarative Technology Profile (`tech-profile.yaml`) + +The entire agent skill suite dynamically adapts to your project's technology stack via `tech-profile.yaml` at the repository root. + +```yaml +project: + name: "Universal Enterprise Platform" + code: "UEP" + archetype: "greenfield" # 'greenfield' or 'brownfield' + +governance: + tailoring_tier: "tier_2_standard_enterprise" # tier_1_high_assurance | tier_2_standard_enterprise | tier_3_fast_track + enforce_deterministic_gates: true + +stack: + architecture_pattern: "modular_monolith" # modular_monolith | microservices | event_driven | serverless + multi_tenancy: + enabled: true + model: "row_level_security" # row_level_security | schema_per_tenant | database_per_tenant + + backend: + language: "python" # python | typescript | go | java | csharp | rust + framework: "fastapi" # fastapi | django | express | nestjs | gin | spring_boot + orm: "sqlalchemy" # sqlalchemy | prisma | typeorm | gorm | hibernate + migrations: "alembic" # alembic | prisma | flyway | golang_migrate + test_framework: "pytest" + + frontend: + framework: "react" # react | vue | angular | svelte | nextjs | flutter + language: "typescript" + ui_library: "tailwind_shadcn" + e2e_framework: "playwright" + +quality_targets: + coverage_thresholds: + backend_domain_fsm: 95.0 + integration_adapters: 90.0 + frontend_components: 80.0 + test_coverage_threshold: 95.0 +``` + + +--- + +## Autonomous Multi-Agent Topology + +AI agents execute specialized roles across the lifecycle: + +| Agent Persona | Role & Responsibilities | Primary Skills | +|---|---|---| +| **`@requirements-analyst`** | PRD/BRD extraction, ambiguity logging, use-case authoring | `up-brd-extract`, `up-use-case-author` | +| **`@spike-architect`** | Risk scoring, walking skeleton spike, domain HLD/LLD templates | `up-arch-risk-spike`, `up-hld-lld-generate` | +| **`@ui-designer-dev`** | Wireframe specs, UI tokens, responsive frontend components | `up-wireframe-spec`, `up-code-generate` | +| **`@backend-dev`** | Database migrations, deterministic API routers, Wave 0 sandboxes | `up-code-generate` | +| **`@adversarial-tester`** | Multi-path test suites ($\ge 95\%$), Bruno API collections, 21-sheet QA workbooks | `up-test-model-generate`, `up-defect-fix` | +| **`@gatekeeper`** | Enforces quality gates (5.1, 9.1, 14.1), verifies delivery surfaces, computes CR impact | `up-traceability-gate`, `up-change-request-impact` | + +--- + +## Quickstart: Creating a New Project from this Framework + +1. **Clone or create a new repository from this branch:** + ```bash + git clone -b process-generic my-new-project + cd my-new-project + git remote set-url origin + git push -u origin main + ``` + +2. **Configure project stack:** + ```bash + cp 00_prompts/templates/tech-profile.template.yaml tech-profile.yaml + # Edit tech-profile.yaml with your project name, archetype, and stack choices + ``` + +3. **Bootstrap governance workspace (Stage 0):** + ```bash + # In your AI IDE prompt (Cursor / Claude / Antigravity / Gemini): + /up-project-bootstrap --archetype greenfield + ``` + +--- + +## Repository Structure + +``` +. +├── .agents/skills/ # Canonical, cross-agent skill definitions (18 skills) +│ ├── up-project-bootstrap/ # Stage 0: Workspace & governance setup +│ ├── up-brd-extract/ # Stage 1: Business feature extraction +│ ├── up-legacy-gap-analysis/ # Stages 2-4: Legacy code & screen mining (Brownfield) +│ ├── up-use-case-author/ # Stage 5: Atomic use-case & FR authoring +│ ├── up-arch-risk-spike/ # Stages 6-7: Architecture risk spike & walking skeleton +│ ├── up-srs-derive/ # Stage 8: System requirements & NFR derivation +│ ├── up-hld-lld-generate/ # Stage 9: High-level & low-level design +│ ├── up-iteration-plan/ # Stage 10: Construction iteration planning +│ ├── up-wireframe-spec/ # Stage 11: Screen specifications & routes +│ ├── up-test-model-generate/ # Stage 12: Multi-path tests & 21-sheet QA workbook +│ ├── up-code-generate/ # Stage 13: Wave-based code generation +│ ├── up-defect-fix/ # Stage 14: Defect triage & review +│ ├── up-traceability-gate/ # Gates 5.1, 9.1, 14.1 completeness checks +│ ├── up-parallel-work-integrate/ # Multi-branch AI lane reconciliation +│ ├── up-change-request-impact/ # Formal CR blast-radius analyzer +│ ├── up-context-checkpoint/ # AI session checkpoint & resume protocol +│ ├── up-process-change/ # Meta-governance process updates +│ └── up-uat-handover/ # Stages 15-18: UAT packaging & release +├── 00_prompts/ +│ ├── AI_Native_Unified_Process_v1.md # Core UP-AI v1.0 Process Specification +│ ├── 02_Skills_Usage_Guide.md # Stage-by-stage invocation guide +│ └── templates/ +│ └── tech-profile.template.yaml # Declarative stack configuration template +├── 01_BRD/ # Business Requirements & PRD inputs +├── 04_generated_documentation/ # Governed engineering documentation (Chronological Stages) +│ ├── 00_process_control/ # Stage 0: Registers, Context, Decisions, Checkpoints +│ ├── 01_source_inventories/ # Stage 1: PRD/BRD Feature extractions (BRD-FR-xxx) +│ ├── 02_legacy_analysis/ # Stages 2–4: Brownfield code, DB & screen mining +│ ├── 03_requirements/ # Stages 5 & 8: Atomic Use Cases (UC-xxx) & System Reqs +│ ├── 04_architecture_design/ # Stages 6, 7, 9: Risk Spike, HLD, LLD API/Table Contracts +│ ├── 05_iteration_planning/ # Stage 10: Iteration Backlog, Plan, Surface Matrix +│ ├── 06_wireframes/ # Stage 11: Screen Specifications, Design Tokens (DESIGN.md) +│ ├── 07_test_design/ # Stage 12: Test Strategy, Multi-Path Models, QA Workbooks +│ └── 08_review_ready_baselines/ # Stage 18: Handover & Acceptance Baselines +├── scripts/ +│ ├── init-new-project.sh # Scaffolds new projects with UP-AI directory structure +│ ├── generate_manual_qa_workbook.py # 21-sheet Excel Manual QA Workbook compiler +│ ├── verify_traceability_gates.py # Deterministic CLI quality gate validator (Gates 5.1, 9.1, 14.1) +│ └── run_tests.sh # Multi-level test runner (--scope project|iteration|uc|fr) +├── AGENTS.md # AI pair programming guidelines & transcript rules +├── CLAUDE.md # Claude Code instructions pointer +├── GEMINI.md # Gemini instructions pointer +├── tech-profile.yaml # Active declarative project configuration +└── README.md # Framework orientation & guide +``` + +--- + +## Single Traceability Chain + +Every requirement, design artifact, code commit, and test case follows a strictly verifiable ID prefix: + +``` +PRD / BRD Feature: BRD-FR-xxx + │ + ▼ +Use Case: UC-xxx + │ + ▼ +Functional Req: FR-xxx (child of exactly one UC-xxx) + │ + ├──► System & NFR Req: SRS-xxx / NFR-xxx + ├──► Architecture Spec: HLD- / LLD-API-xxx / LLD-TBL-xxx + ├──► Backlog User Story: STORY-xxx + └──► Multi-Path Tests: TC-xxx (Unit | API | Contract | E2E | Smoke | Usability) +``` + +--- + +## License & Governance + +This framework is governed under the **AI-Native Unified Process Specification v1.1** ([`AI_Native_Unified_Process_v1.md`](00_prompts/AI_Native_Unified_Process_v1.md)). Process modifications follow the formal `up-process-change` lifecycle (Process-Adjustment CRs). + diff --git a/prompts/20261003T094245Z-session-process-analysis-cmm3.md b/prompts/20261003T094245Z-session-process-analysis-cmm3.md new file mode 100644 index 0000000..e69de29 diff --git a/scripts/generate_manual_qa_workbook.py b/scripts/generate_manual_qa_workbook.py new file mode 100755 index 0000000..38e7439 --- /dev/null +++ b/scripts/generate_manual_qa_workbook.py @@ -0,0 +1,236 @@ +#!/usr/bin/env python3 +"""Canonical Manual QA Excel Workbook Generator for AI-Native Unified Process. + +Standardized per UP-AI v1.0 Quality Standard. +Compiles a 21-sheet, 30-column Excel workbook under: +04_generated_documentation/07_test_design/manual_qa/workbooks/IterationNN__Complete_Manual_Testcases.xlsx +""" +import argparse +import os +import sys +from pathlib import Path + +try: + import openpyxl + from openpyxl.styles import Alignment, Border, Font, PatternFill, Side + from openpyxl.utils import get_column_letter +except ImportError: + print("Error: openpyxl is required. Run via 'uv run --with openpyxl python3 scripts/generate_manual_qa_workbook.py'") + sys.exit(1) + +COLUMNS = [ + "Test Case ID", "Test Case Name", "Test Objective / Description", "Scope Status", + "Related BRD Requirement ID(s)", "Related Use Case ID(s)", "Related FR ID(s)", + "Related SRS / NFR ID(s)", "Related Story ID(s)", "Related Business Rule / Acceptance Criterion", + "Related HLD / LLD / Contract Reference", "Related Screen / Route / API / Data / Integration Surface", + "Actor / Role / Portal", "Test Category", "Test Level", "Priority", "Preconditions", + "Test Steps", "Test Data", "Expected Result", "Prohibited Side Effects", + "Postconditions / Cleanup", "Result (Dev)", "Result (Staging)", "Result (Production)", + "Actual Result / Evidence", "Defect Reference", "Comment", "Source References", "Execution Type" +] + +TEST_CATEGORIES = [ + ("Functional_Testcase", "Functional"), + ("Validation_Testcase", "Validation"), + ("Boundary-Value_Testcase", "Boundary-Value"), + ("Negative_Testcase", "Negative"), + ("Security_Testcase", "Security"), + ("Database_Testcase", "Database"), + ("API_Testcase", "API"), + ("Performance_Testcase", "Performance"), + ("UAT_Testcase", "UAT"), + ("Integration_Testcase", "Integration"), + ("CrossBrowser_Testcase", "CrossBrowser"), + ("Accessibility_Testcase", "Accessibility"), + ("Mobile-Responsive_Testcase", "Mobile-Responsive"), + ("AI-ML_Testcase", "AI-ML"), + ("Regression_Testcase", "Regression"), + ("Automation_Testcase", "Automation"), +] + +def build_workbook(iteration: str, name: str, output_path: str, cases_by_category: dict = None, manifest_rows: list = None, summary_metadata: list = None, notes: list = None, traceability_rows: list = None): + wb = openpyxl.Workbook() + wb.remove(wb.active) + + navy_fill = PatternFill(start_color="001F4E78", end_color="001F4E78", fill_type="solid") + header_font = Font(name="Calibri", size=11, bold=True, color="FFFFFF") + bold_font = Font(name="Calibri", size=11, bold=True) + regular_font = Font(name="Calibri", size=10) + thin_border = Border( + left=Side(style="thin", color="D9D9D9"), + right=Side(style="thin", color="D9D9D9"), + top=Side(style="thin", color="D9D9D9"), + bottom=Side(style="thin", color="D9D9D9"), + ) + + # 1. Coverage_Summary + ws_cov = wb.create_sheet(title="Coverage_Summary") + ws_cov.append(["Field", "Value"]) + for cell in ws_cov[1]: + cell.fill = navy_fill + cell.font = header_font + + if not summary_metadata: + summary_metadata = [ + ("Scope Name", f"Iteration {iteration} Complete Manual QA — {name}"), + ("Process Baseline", "AI_Native_Unified_Process_v1.md (UP-AI v1.0)"), + ("Status", "Approved / Verified via Stage 12 & Gate 14.1"), + ] + for k, v in summary_metadata: + ws_cov.append([k, v]) + for row in ws_cov.iter_rows(min_row=2): + row[0].font = bold_font + row[1].font = regular_font + for cell in row: + cell.border = thin_border + ws_cov.column_dimensions["A"].width = 30 + ws_cov.column_dimensions["B"].width = 80 + + # 2. Scope_Manifest + ws_scope = wb.create_sheet(title="Scope_Manifest") + ws_scope.append(["Selector", "Resolved ID / Path", "Item Type", "Parent Chain", "Iteration", "Status", "Disposition"]) + for cell in ws_scope[1]: + cell.fill = navy_fill + cell.font = header_font + cell.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True) + if manifest_rows: + for r in manifest_rows: + ws_scope.append(r) + for row in ws_scope.iter_rows(min_row=2): + for cell in row: + cell.font = regular_font + cell.border = thin_border + for col in ws_scope.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = get_column_letter(col[0].column) + ws_scope.column_dimensions[col_letter].width = max(max_len + 2, 14) + + # 3. 16 Test Category Sheets + cat_summary = [] + cases_by_category = cases_by_category or {} + + for sheet_name, cat_title in TEST_CATEGORIES: + ws = wb.create_sheet(title=sheet_name) + ws.append(COLUMNS) + for cell in ws[1]: + cell.fill = navy_fill + cell.font = header_font + cell.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True) + + cat_cases = cases_by_category.get(sheet_name, []) + for c in cat_cases: + if isinstance(c, list): + row_val = c + [""] * (30 - len(c)) if len(c) < 30 else c[:30] + ws.append(row_val) + elif isinstance(c, dict): + row_val = [c.get(col, "") for col in COLUMNS] + ws.append(row_val) + + for row in ws.iter_rows(min_row=2): + for cell in row: + cell.font = regular_font + cell.border = thin_border + + for col in ws.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = get_column_letter(col[0].column) + ws.column_dimensions[col_letter].width = min(max(max_len + 2, 12), 40) + + tot_c = len(cat_cases) + auto_c = sum(1 for c in cat_cases if (c[29] if isinstance(c, list) else c.get("Execution Type")) == "Automated") + man_c = sum(1 for c in cat_cases if (c[29] if isinstance(c, list) else c.get("Execution Type")) == "Manual") + both_c = sum(1 for c in cat_cases if (c[29] if isinstance(c, list) else c.get("Execution Type")) == "Both" or (c[29] if isinstance(c, list) else "").startswith("Automated +")) + pct = f"{(auto_c + both_c) / tot_c * 100:.1f}%" if tot_c > 0 else "0.0%" + cat_summary.append((sheet_name, tot_c, auto_c, man_c, both_c, pct)) + + # 4. Execution Summary + ws_exec = wb.create_sheet(title="Execution Summary", index=1) + ws_exec.append([f"Execution Summary - Iteration {iteration} {name}", "", "", "", "", ""]) + ws_exec.append([]) + ws_exec.append(["Test Category", "Total Test Cases", "Automation", "Manual", "Both", "Automation Percentage"]) + for cell in ws_exec[3]: + cell.fill = navy_fill + cell.font = header_font + + tot_tc = sum(x[1] for x in cat_summary) + tot_auto = sum(x[2] for x in cat_summary) + tot_man = sum(x[3] for x in cat_summary) + tot_both = sum(x[4] for x in cat_summary) + overall_pct = f"{(tot_auto + tot_both) / tot_tc * 100:.1f}%" if tot_tc > 0 else "0.0%" + + for r in cat_summary: + ws_exec.append(list(r)) + ws_exec.append([]) + ws_exec.append(["TOTAL", tot_tc, tot_auto, tot_man, tot_both, overall_pct]) + for cell in ws_exec[ws_exec.max_row]: + cell.font = bold_font + + for row in ws_exec.iter_rows(min_row=3): + for cell in row: + cell.border = thin_border + + for col in ws_exec.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = get_column_letter(col[0].column) + ws_exec.column_dimensions[col_letter].width = max(max_len + 2, 16) + + # 5. Traceability_Matrix + ws_tm = wb.create_sheet(title="Traceability_Matrix") + ws_tm.append(["Use Case ID", "FR ID", "Story ID", "Test Case ID", "Test Category", "Portal / Surface", "Automation Status"]) + for cell in ws_tm[1]: + cell.fill = navy_fill + cell.font = header_font + cell.alignment = Alignment(horizontal="center", vertical="center", wrap_text=True) + + t_rows = traceability_rows if traceability_rows is not None else manifest_rows + if t_rows: + for r in t_rows: + ws_tm.append(r) + + for row in ws_tm.iter_rows(min_row=2): + for cell in row: + cell.font = regular_font + cell.border = thin_border + + for col in ws_tm.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = get_column_letter(col[0].column) + ws_tm.column_dimensions[col_letter].width = max(max_len + 2, 14) + + # 6. Generation_Notes + ws_notes = wb.create_sheet(title="Generation_Notes") + ws_notes.append(["Note ID", "Section", "Detail"]) + for cell in ws_notes[1]: + cell.fill = navy_fill + cell.font = header_font + if notes: + for n in notes: + ws_notes.append(n) + for row in ws_notes.iter_rows(min_row=2): + for cell in row: + cell.font = regular_font + cell.border = thin_border + for col in ws_notes.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = get_column_letter(col[0].column) + ws_notes.column_dimensions[col_letter].width = max(max_len + 2, 16) + + out_file = Path(output_path) + out_file.parent.mkdir(parents=True, exist_ok=True) + wb.save(str(out_file)) + print(f"Successfully compiled 21-sheet QA workbook at: {out_file} (Total Cases: {tot_tc})") + + +def main(): + parser = argparse.ArgumentParser(description="Compile 21-sheet Manual QA Excel Workbook") + parser.add_argument("--iteration", required=True, help="Iteration number (e.g. 02, 03)") + parser.add_argument("--name", required=True, help="Iteration Name (e.g. Customer_Vendor_Onboarding)") + parser.add_argument("--output", help="Optional output path") + args = parser.parse_args() + + default_out = f"04_generated_documentation/07_test_design/manual_qa/workbooks/Iteration{args.iteration}_{args.name}_Complete_Manual_Testcases.xlsx" + out_path = args.output or default_out + build_workbook(iteration=args.iteration, name=args.name, output_path=out_path) + +if __name__ == "__main__": + main() diff --git a/scripts/init-new-project.sh b/scripts/init-new-project.sh new file mode 100755 index 0000000..440c115 --- /dev/null +++ b/scripts/init-new-project.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# ============================================================================== +# UP-AI v1.0 Generic Project Initializer +# ============================================================================== +# Helper script to initialize a new project workspace from the UP-AI template. +# +# Usage: +# ./scripts/init-new-project.sh --name "My Project" --code "MYP" --archetype +# ============================================================================== + +set -euo pipefail + +repo_root="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" + +project_name="New Project" +project_code="NP" +archetype="greenfield" + +usage() { + printf 'Usage: %s [--name "Project Name"] [--code "CODE"] [--archetype ]\n' "$0" >&2 + exit 1 +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --name) + project_name="${2:-}" + shift 2 + ;; + --code) + project_code="${2:-}" + shift 2 + ;; + --archetype) + archetype="${2:-greenfield}" + shift 2 + ;; + -h|--help) + usage + ;; + *) + printf 'Unknown argument: %s\n' "$1" >&2 + usage + ;; + esac +done + +printf '== Initializing UP-AI v1.0 for [%s] (Code: %s, Archetype: %s) ==\n' "$project_name" "$project_code" "$archetype" + +# 1. Initialize tech-profile.yaml if not present +if [[ ! -f "$repo_root/tech-profile.yaml" ]]; then + if [[ -f "$repo_root/00_prompts/templates/tech-profile.template.yaml" ]]; then + printf 'Creating tech-profile.yaml from template...\n' + cp "$repo_root/00_prompts/templates/tech-profile.template.yaml" "$repo_root/tech-profile.yaml" + sed -i "s/name: .*/name: \"$project_name\"/" "$repo_root/tech-profile.yaml" + sed -i "s/code: .*/code: \"$project_code\"/" "$repo_root/tech-profile.yaml" + sed -i "s/archetype: .*/archetype: \"$archetype\"/" "$repo_root/tech-profile.yaml" + fi +fi + +# 2. Create chronological directory structure +mkdir -p "$repo_root/01_BRD" +mkdir -p "$repo_root/04_generated_documentation/00_process_control/checkpoints" +mkdir -p "$repo_root/04_generated_documentation/01_source_inventories" +mkdir -p "$repo_root/04_generated_documentation/03_requirements/use_cases" +mkdir -p "$repo_root/04_generated_documentation/04_architecture_design/lld" +mkdir -p "$repo_root/04_generated_documentation/05_iteration_planning/iterations" +mkdir -p "$repo_root/04_generated_documentation/06_wireframes" +mkdir -p "$repo_root/04_generated_documentation/07_test_design/manual_qa/workbooks" +mkdir -p "$repo_root/04_generated_documentation/08_review_ready_baselines" +mkdir -p "$repo_root/prompts" + +if [[ "$archetype" == "brownfield" ]]; then + mkdir -p "$repo_root/02_legacy_source_code" + mkdir -p "$repo_root/03_old_screenshots" + mkdir -p "$repo_root/04_generated_documentation/02_legacy_analysis" +fi + +printf '\nInitialization complete! Next steps:\n' +printf '1. Add your requirements to 01_BRD/\n' +if [[ "$archetype" == "brownfield" ]]; then + printf '2. Place legacy code in 02_legacy_source_code/ and screenshots in 03_old_screenshots/\n' +fi +printf '3. Review and customize tech-profile.yaml with your stack choices\n' +printf '4. In your AI IDE, run: /up-project-bootstrap --archetype %s\n' "$archetype" diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh new file mode 100755 index 0000000..d1fb594 --- /dev/null +++ b/scripts/run_tests.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash +# Multi-level test runner (UP-AI v1.0, process doc §8.4). +# +# Dispatches to pytest / Playwright / Bruno underneath one command surface, +# scoped to the whole project, one iteration, one use case, or one FR. +# Tagging convention (07_test_design/test_strategy.md §5.4): +# pytest -> marker named after the lowercased, underscored identifier +# (UC-011 -> uc_011, FR-CBC-004 -> fr_cbc_004, STORY-042 -> story_042, +# iteration-02 -> iteration_02) +# Playwright -> literal @-prefixed token in the spec's title/describe string +# (UC-011 -> @UC-011) +# Bruno -> a `tags` array in each request/folder's `meta` block; this +# script greps .bru files for a matching tag and runs only +# the matched files, since the Bruno CLI has no native tag filter. +# +# Usage: +# scripts/run_tests.sh --scope project +# scripts/run_tests.sh --scope iteration-02 +# scripts/run_tests.sh --scope uc-011 +# scripts/run_tests.sh --scope fr-cbc-004 +# +# `--scope iteration-NN` re-runs the cumulative regression suite for every +# already-Delivered FR in addition to that iteration's own tests, per Gate +# 14.1's regression-suite-health criterion — it does not filter pytest/ +# Playwright/Bruno any differently from a plain iteration tag; the +# regression-suite-wide re-run is achieved by iteration tags also being +# applied to every regression case folded in from a prior iteration +# (07_test_design/regression_test_cases.md records which iteration a +# regression case is tagged with in addition to its origin iteration). + +set -euo pipefail + +repo_root="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" +workspace_dir="$repo_root/05_implementation_workspace" +bruno_root="$workspace_dir" +env_name="dev" +scope="" + +usage() { + printf 'Usage: %s --scope [--env ]\n' "$0" >&2 + exit 1 +} + +while [[ $# -gt 0 ]]; do + case "$1" in + --scope) + scope="${2:-}" + shift 2 + ;; + --env) + env_name="${2:-dev}" + shift 2 + ;; + -h|--help) + usage + ;; + *) + printf 'Unknown argument: %s\n' "$1" >&2 + usage + ;; + esac +done + +[[ -n "$scope" ]] || usage + +# Resolve scope into a pytest marker name, a Playwright @-tag, and a Bruno +# grep token. "project" means "run everything, no filter." +pytest_marker="" +playwright_tag="" +bruno_tag="" + +if [[ "$scope" != "project" ]]; then + # normalize: lowercase, hyphens -> underscores for the pytest marker; + # uppercase-with-hyphens for the Playwright/Bruno @-tag. + lower_underscored="$(printf '%s' "$scope" | tr '[:upper:]' '[:lower:]' | tr '-' '_')" + upper_hyphenated="$(printf '%s' "$scope" | tr '[:lower:]' '[:upper:]')" + pytest_marker="$lower_underscored" + playwright_tag="@${upper_hyphenated}" + bruno_tag="${upper_hyphenated}" +fi + +printf '== run_tests.sh: scope=%s env=%s ==\n' "$scope" "$env_name" + +# ---- pytest (backend unit/integration) ---- +pytest_found=0 +if command -v pytest >/dev/null 2>&1; then + while IFS= read -r -d '' tests_dir; do + pytest_found=1 + printf -- '-- pytest: %s\n' "$tests_dir" + if [[ "$scope" == "project" ]]; then + pytest "$tests_dir" + else + pytest "$tests_dir" -m "$pytest_marker" + fi + done < <(find "$workspace_dir" -type d -name tests -not -path '*/node_modules/*' -not -path '*/.venv/*' -print0 2>/dev/null) +fi +if [[ "$pytest_found" -eq 0 ]]; then + printf -- '-- pytest: no tests/ directory found under %s yet (skipped)\n' "$workspace_dir" +fi + +# ---- Playwright (browser E2E / smoke) ---- +playwright_found=0 +while IFS= read -r -d '' config; do + playwright_found=1 + project_dir="$(dirname "$config")" + printf -- '-- playwright: %s\n' "$config" + ( + cd "$project_dir" + if [[ "$scope" == "project" ]]; then + npx playwright test + else + npx playwright test --grep "$playwright_tag" + fi + ) +done < <(find "$workspace_dir" -maxdepth 3 \( -name 'playwright.config.ts' -o -name 'playwright.config.js' \) -not -path '*/node_modules/*' -print0 2>/dev/null) +if [[ "$playwright_found" -eq 0 ]]; then + printf -- '-- playwright: no playwright.config.* found under %s yet (skipped)\n' "$workspace_dir" +fi + +# ---- Bruno (API collections) ---- +bruno_found=0 +bruno_files=() +while IFS= read -r -d '' bru_file; do + if [[ "$scope" == "project" ]]; then + bruno_files+=("$bru_file") + elif grep -q "$bruno_tag" "$bru_file" 2>/dev/null; then + bruno_files+=("$bru_file") + fi +done < <(find "$bruno_root" -type f -name '*.bru' -path '*/bruno/*' -print0 2>/dev/null) + +if [[ "${#bruno_files[@]}" -gt 0 ]]; then + bruno_found=1 + if ! command -v bru >/dev/null 2>&1; then + printf -- '-- bruno: %d matching .bru file(s) found but the `bru` CLI is not installed (skipped)\n' "${#bruno_files[@]}" + else + declare -A bruno_folders_seen=() + for bru_file in "${bruno_files[@]}"; do + folder="$(dirname "$bru_file")" + if [[ -z "${bruno_folders_seen[$folder]:-}" ]]; then + bruno_folders_seen["$folder"]=1 + printf -- '-- bruno: %s (env=%s)\n' "$folder" "$env_name" + bru run "$folder" --env "$env_name" + fi + done + fi +fi +if [[ "$bruno_found" -eq 0 ]]; then + printf -- '-- bruno: no matching .bru collections found under %s yet (skipped)\n' "$bruno_root" +fi + +printf '== run_tests.sh: done ==\n' diff --git a/scripts/verify_traceability_gates.py b/scripts/verify_traceability_gates.py new file mode 100755 index 0000000..e69de29 diff --git a/tech-profile.yaml b/tech-profile.yaml new file mode 100644 index 0000000..557b013 --- /dev/null +++ b/tech-profile.yaml @@ -0,0 +1,112 @@ +# ============================================================================== +# AI-Native Unified Process (UP-AI v1.0) - Declarative Technology Profile +# ============================================================================== +# This configuration file defines the active architecture, technology stack, +# archetype (greenfield vs. brownfield), testing frameworks, and integration +# sandboxes for the target project. +# +# All UP-AI agent skills dynamically read this profile during Inception, +# Elaboration, Construction, and Transition phases. +# ============================================================================== + +project: + name: "Universal Enterprise Platform" + code: "UEP" + version: "1.0.0" + description: "Enterprise software modern platform" + # Archetype: 'greenfield' (0-to-1 development) or 'brownfield' (legacy modernization/migration) + archetype: "greenfield" + +# Inception Configuration +inception: + # Source document paths + requirements_inputs: + - "01_BRD/PRD_Specification.md" + # Brownfield-only sources (ignored if archetype is greenfield) + legacy_sources: + source_code_dir: "02_legacy_source_code" + database_dump_dir: "02_legacy_source_code/schema" + screenshots_dir: "03_legacy_screen_shots" + +# Architecture & Target Technology Stack +stack: + architecture_pattern: "modular_monolith" # Options: modular_monolith | microservices | event_driven | serverless + multi_tenancy: + enabled: true + model: "row_level_security" # Options: row_level_security | schema_per_tenant | database_per_tenant + + backend: + language: "python" # Options: python | typescript | go | java | csharp | rust + framework: "fastapi" # Options: fastapi | django | express | nestjs | gin | spring_boot | dotnet_core + orm: "sqlalchemy" # Options: sqlalchemy | prisma | typeorm | gorm | hibernate | ef_core + migrations: "alembic" # Options: alembic | prisma | flyway | golang_migrate | dbup + api_standard: "rest_openapi" # Options: rest_openapi | graphql | grpc + test_framework: "pytest" + coverage_tool: "pytest-cov" + + frontend: + framework: "react" # Options: react | vue | angular | svelte | nextjs | flutter + language: "typescript" + state_management: "zustand" # Options: zustand | redux_toolkit | pinia | context_api + ui_library: "tailwind_shadcn" # Options: tailwind_shadcn | mui | ant_design | vanilla_css + design_system_tokens: "04_generated_documentation/06_wireframes/DESIGN.md" + test_framework: "vitest" + e2e_framework: "playwright" + + authentication: + provider: "keycloak" # Options: keycloak | auth0 | cognito | supabase_auth | firebase_auth | custom_oidc + protocol: "oidc_pkce" + token_standard: "jwt_bearer" + authorization_model: "rbac_abac" # Options: rbac | rbac_abac | casbin | opa + + database: + primary: "postgresql" # Options: postgresql | mysql | mariadb | mongodb | dynamodb + cache_and_streams: "valkey" # Options: valkey | redis | none + search_engine: "none" # Options: elasticsearch | opensearch | pg_trgm | none + +# Wave 0 Integration Sandboxes +# Every third-party external dependency MUST declare a deterministic mock/sandbox adapter. +sandboxes: + - id: "identity_provider" + service_name: "Auth & Identity" + mock_adapter_path: "sandbox/identity_mock.py" + mock_mode: "deterministic" # Options: deterministic | replay | live_proxy + - id: "payment_gateway" + service_name: "Payment & Settlement" + mock_adapter_path: "sandbox/payment_mock.py" + mock_mode: "deterministic" + - id: "messaging_service" + service_name: "SMS / Email Notification" + mock_adapter_path: "sandbox/notification_mock.py" + mock_mode: "deterministic" + +# Governance & Process Tailoring (CMMI Level 3 / UP-AI v1.1) +governance: + # Tailoring Tier Options: + # - 'tier_1_high_assurance' (Mission-critical / Financial: All 18 stages, >=95% coverage across all tiers, dual QA) + # - 'tier_2_standard_enterprise' (Default: Core UP flow, differentiated coverage, standard QA deliverables) + # - 'tier_3_fast_track' (Internal prototypes: Direct to construction, unit/smoke testing, minimal ceremony) + tailoring_tier: "tier_2_standard_enterprise" + enforce_deterministic_gates: true + gate_validator_script: "scripts/verify_traceability_gates.py" + +# Quality Targets & Gate 14.1 Mandates +quality_targets: + # Differentiated Coverage Budgets (UP-AI v1.1) + coverage_thresholds: + backend_domain_fsm: 95.0 # Hard gate for core business FSMs, algorithms, security + integration_adapters: 90.0 # Deterministic sandbox verification + frontend_components: 80.0 # UI component branch coverage + mandatory Playwright E2E + test_coverage_threshold: 95.0 # Baseline fallback + required_test_dimensions: + - "happy_path" + - "alternate_and_boundary" + - "negative_validation_failures" + - "fsm_invariants_and_concurrency" + required_test_levels: + - "unit" + - "api_contract_bruno" + - "browser_e2e_playwright" + - "smoke" + - "manual_qa_workbook_21_sheets" # Enforced by Gate 14.1 +