Standards & Reference

Compliance

This document outlines the compliance requirements and standards for the Flowstate application development process.

Table of Contents

  1. Overview
  2. FlowState Standard
  3. Development Compliance
  4. Documentation Compliance
  5. Testing Compliance
  6. Security Compliance
  7. Accessibility Compliance
  8. Audit Process
  9. Compliance Checklist

Overview

All development activities must adhere to the FlowState Standard, ensuring consistent quality, maintainability, and auditability across the project.

Compliance Objectives

  • Quality Assurance: Maintain high code quality standards
  • Traceability: Track all changes and decisions
  • Security: Protect data and prevent vulnerabilities
  • Accessibility: Ensure inclusive user experience
  • Documentation: Maintain comprehensive documentation

Governance

RoleResponsibility
Project LeadOverall compliance oversight
Tech LeadTechnical standards enforcement
QA LeadTesting compliance verification
Security LeadSecurity review and approval

FlowState Standard

The FlowState Standard defines the minimum requirements for software development on this project.

Required Documents

Every project must maintain the following documentation:

DocumentPurposeReview Frequency
TDD.mdTest-driven development processPer release
BAT.mdBrowser automation testingPer release
DOCUMENTATION.mdUser documentation standardsQuarterly
CHANGELOG.mdChange trackingContinuous
QUALITY.mdCode quality standardsQuarterly
PROCESS.mdDevelopment processQuarterly
SECURITY.mdSecurity standardsQuarterly
ARCHITECTURE.mdSystem architecturePer major release

Compliance Verification

// scripts/verify-compliance.ts
interface ComplianceCheck {
  document: string;
  exists: boolean;
  lastUpdated: Date;
  isStale: boolean;
  issues: string[];
}

async function verifyFlowStateCompliance(): Promise<ComplianceCheck[]> {
  const requiredDocs = [
    'TDD.md',
    'BAT.md',
    'DOCUMENTATION.md',
    'CHANGELOG.md',
    'QUALITY.md',
    'PROCESS.md',
    'SECURITY.md',
    'ARCHITECTURE.md',
  ];

  const checks: ComplianceCheck[] = [];

  for (const doc of requiredDocs) {
    const check = await verifyDocument(`docs/${doc}`);
    checks.push(check);
  }

  return checks;
}

Development Compliance

Code Review Requirements

All code changes must pass review before merging:

CriteriaRequirementVerification
Peer ReviewMinimum 1 approving reviewGitHub PR settings
Test CoverageMinimum 80% coverageCI pipeline
LintingZero errorsPre-commit hook
Type SafetyNo TypeScript errorsBuild process
DocumentationJSDoc for public APIsReview checklist

Commit Standards

type(scope): description

[optional body]

[optional footer]

Required Elements:

  • Type prefix (feat, fix, docs, etc.)
  • Concise description
  • Issue reference (when applicable)

Validation:

# .husky/commit-msg
npx commitlint --edit $1

Branch Protection Rules

BranchRequirements
main2 approvals, passing CI, no force push
dev1 approval, passing CI
feature/*Passing CI
hotfix/*1 approval, passing CI

Pull Request Template

## Description
[Describe the changes]

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No new warnings
- [ ] Self-reviewed
- [ ] Linked to issue

## Testing Instructions
[How to test these changes]

## Screenshots (if applicable)

Documentation Compliance

Required Documentation

Component TypeDocumentation Required
View/PageHelp article, workflow guide
ComponentProps documentation, usage examples
HookJSDoc, usage examples
ServiceAPI documentation
UtilityJSDoc, examples

Documentation Standards

/**
 * Filters events by status.
 *
 * @param events - Array of events to filter
 * @param status - Status to filter by ('on-track', 'at-risk', 'delayed')
 * @returns Filtered array of events
 *
 * @example
 * ```ts
 * const filtered = filterEventsByStatus(events, 'on-track');
 * ```
 *
 * @see {@link EventStatus} for valid status values
 */
export function filterEventsByStatus(
  events: Event[],
  status: EventStatus
): Event[] {
  return events.filter(e => e.status === status);
}

Help Center Coverage

Every user-facing feature must have:

  1. Overview documentation
  2. Step-by-step workflow guide
  3. Screenshots (current version)
  4. FAQ entries (as needed)
  5. Troubleshooting section

Testing Compliance

Test Coverage Requirements

CategoryMinimum CoverageTarget Coverage
Statements80%90%
Branches75%85%
Functions80%90%
Lines80%90%

Test Types Required

Test TypeScopeFrequency
Unit TestsFunctions, componentsEvery change
Integration TestsComponent interactionsEvery feature
E2E TestsCritical user flowsEvery release
Visual RegressionUI consistencyEvery UI change
Performance TestsLoad times, bundle sizeWeekly
Accessibility TestsWCAG complianceEvery UI change

Test Quality Standards

// Example: Well-structured test
describe('EventCard', () => {
  describe('when status is delayed', () => {
    it('displays red border indicator', () => {
      // Arrange
      const event = createTestEvent({ status: 'delayed' });

      // Act
      render(<EventCard event={event} />);

      // Assert
      expect(screen.getByTestId('event-card')).toHaveClass('border-l-red-500');
    });
  });
});

CI Pipeline Requirements

# Required CI checks
jobs:
  lint:
    - ESLint (zero errors)
    - TypeScript (zero errors)
    - Prettier (formatted)

  test:
    - Unit tests (passing)
    - Coverage threshold (met)

  build:
    - Production build (successful)
    - Bundle size (within limits)

  e2e:
    - Critical path tests (passing)
    - Visual regression (no unexpected changes)

Security Compliance

Security Requirements

RequirementImplementationVerification
Input ValidationZod schemasCode review
XSS PreventionReact escaping, DOMPurifySecurity scan
CSRF ProtectionToken-basedPenetration test
AuthenticationAzure AD / MSALSecurity audit
AuthorizationRole-based accessIntegration tests
Data EncryptionHTTPS, encrypted storageConfiguration audit

Dependency Security

// package.json
{
  "scripts": {
    "audit": "npm audit",
    "audit:fix": "npm audit fix",
    "security:check": "snyk test"
  }
}

Requirements:

  • No critical vulnerabilities
  • No high vulnerabilities (without mitigation plan)
  • Weekly dependency audit
  • Automated Dependabot updates

Sensitive Data Handling

Data TypeHandlingStorage
CredentialsNever in codeEnvironment variables
API KeysNever in codeSecure vault
PIIEncryptedServer-side only
Session DataSecure cookiesHttpOnly, Secure flags

Security Review Checklist

  • [ ] No hardcoded secrets
  • [ ] Input validation on all forms
  • [ ] Output encoding for dynamic content
  • [ ] Authentication required for protected routes
  • [ ] Authorization checked for actions
  • [ ] Secure headers configured
  • [ ] HTTPS enforced
  • [ ] Dependencies audited

Accessibility Compliance

WCAG 2.1 Requirements

Target: Level AA Compliance

PrincipleRequirements
PerceivableText alternatives, captions, adaptable content
OperableKeyboard accessible, sufficient time, no seizures
UnderstandableReadable, predictable, input assistance
RobustCompatible with assistive technologies

Implementation Standards

// Accessible component example
const EventCard: React.FC<EventCardProps> = ({ event, onClick }) => {
  return (
    <article
      role="article"
      aria-label={`Event: ${event.name}`}
      tabIndex={0}
      onClick={onClick}
      onKeyDown={(e) => e.key === 'Enter' && onClick?.()}
      className="..."
    >
      <h3 id={`event-${event.id}-title`}>{event.name}</h3>
      <div aria-labelledby={`event-${event.id}-title`}>
        {/* Content */}
      </div>
    </article>
  );
};

Accessibility Testing

// e2e/tests/accessibility.spec.ts
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';

test.describe('Accessibility', () => {
  test('dashboard has no accessibility violations', async ({ page }) => {
    await page.goto('/dashboard');

    const results = await new AxeBuilder({ page })
      .withTags(['wcag2a', 'wcag2aa'])
      .analyze();

    expect(results.violations).toEqual([]);
  });
});

Accessibility Checklist

  • [ ] All images have alt text
  • [ ] Form fields have labels
  • [ ] Color contrast meets AA standards
  • [ ] Focus indicators visible
  • [ ] Keyboard navigation works
  • [ ] Screen reader compatible
  • [ ] No content depends solely on color
  • [ ] Error messages are descriptive

Audit Process

Audit Schedule

Audit TypeFrequencyScope
Code QualityPer PRChanged files
SecurityMonthlyFull codebase
AccessibilityPer releaseUI changes
DocumentationQuarterlyAll docs
ComplianceQuarterlyFull review

Audit Report Template

# Compliance Audit Report

**Date**: YYYY-MM-DD
**Auditor**: [Name]
**Scope**: [Description]

## Summary
Overall compliance status: [Compliant/Non-Compliant/Partial]

## Findings

### Critical
- [Finding 1]

### High
- [Finding 2]

### Medium
- [Finding 3]

### Low
- [Finding 4]

## Recommendations
1. [Recommendation 1]
2. [Recommendation 2]

## Action Items
| Item | Owner | Due Date | Status |
|------|-------|----------|--------|
| Fix critical issue | @dev | YYYY-MM-DD | Open |

## Sign-off
- [ ] Project Lead
- [ ] Tech Lead
- [ ] Security Lead

Non-Compliance Handling

  1. Critical Issues: Immediate resolution required, block release
  2. High Issues: Resolution within 1 sprint, may block release
  3. Medium Issues: Resolution within 2 sprints
  4. Low Issues: Resolution within 1 quarter

Compliance Checklist

Pre-Development

  • [ ] Requirements documented
  • [ ] User stories written
  • [ ] Acceptance criteria defined
  • [ ] Security considerations identified
  • [ ] Accessibility requirements noted

During Development

  • [ ] TDD approach followed
  • [ ] Code review requested
  • [ ] Tests written and passing
  • [ ] Documentation updated
  • [ ] No linting errors
  • [ ] No TypeScript errors

Pre-Release

  • [ ] All tests passing
  • [ ] Coverage thresholds met
  • [ ] E2E tests passing
  • [ ] Accessibility audit passed
  • [ ] Security scan passed
  • [ ] Documentation complete
  • [ ] Changelog updated
  • [ ] Release notes prepared

Post-Release

  • [ ] Production verified
  • [ ] Monitoring enabled
  • [ ] Documentation published
  • [ ] Stakeholders notified
  • [ ] Retrospective scheduled

Automation

Compliance CI Checks

# .github/workflows/compliance.yml
name: Compliance Check

on: [push, pull_request]

jobs:
  compliance:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Verify required documents
        run: npm run compliance:docs

      - name: Check test coverage
        run: npm run test:coverage -- --threshold 80

      - name: Security audit
        run: npm audit --audit-level=high

      - name: Accessibility check
        run: npm run test:a11y

      - name: Generate compliance report
        run: npm run compliance:report

Compliance Dashboard

Track compliance metrics over time:

  • Test coverage trends
  • Security vulnerability counts
  • Accessibility issue counts
  • Documentation coverage
  • Audit findings resolution rate

Previous
Security