Skip to content

feat: Sprints 24-29A — comprehensive review, security, a11y, skills, UI components - #4

Merged
rafaelob merged 21 commits into
mainfrom
sprint-26-comprehensive-review-and-improvements
Mar 4, 2026
Merged

feat: Sprints 24-29A — comprehensive review, security, a11y, skills, UI components#4
rafaelob merged 21 commits into
mainfrom
sprint-26-comprehensive-review-and-improvements

Conversation

@rafaelob

@rafaelob rafaelob commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Sprints 24-26: RBAC, Sign Languages, Skills DB, Braille, comprehensive review with 133+ new tests and 10+ critical fixes
  • Sprint 27: Demo storyboard, SessionFactory auth, motor accessibility, a11y theme comparison
  • Sprint 28: Security containment, reliability hardening, JWT hardening, /runs API, diagnostics split
  • Sprint 29A: Security fixes (composite FK migration), skill repository hardening, SSE refactor, bento dashboard, UI components (button/card/illustrations)
  • Infrastructure: CI updates, dependency bumps, ESLint config, sprint plans (29-37)
  • References: Context management guide, prompt caching guide, skills guide, agent best practices

Test plan

  • All 3,889+ runtime tests passing
  • Frontend SSE hooks tested
  • Security fixes validated with dedicated test suite
  • Skill repository pagination/filtering tested

🤖 Generated with Claude Code

rafaelob and others added 21 commits February 19, 2026 22:10
…itical fixes

## Test Coverage Expansion (1,245 → 1,378 frontend tests)
- auth-store.test.ts: 9 tests (login/logout, XSS mitigation, roles)
- api.test.ts: 20 tests (auth headers priority, JWT expiry, demo profiles)
- role-selection-phase.test.tsx: 7 tests (render, a11y, click handlers)
- login-form-phase.test.tsx: 16 tests (form, validation, loading, errors)
- login/page.test.tsx: 9 tests (orchestrator, phase transitions, demo login)
- sign-language-selector.test.tsx: 15 tests (ARIA combobox, keyboard nav)
- wizard-steps.test.tsx: 10 tests (4 wizard steps, validation)
- settings-content.test.tsx: 7 tests (5 sections, landmarks)
- settings/page.test.tsx: 2 tests (async server component)
- progress/page.test.tsx: 2 tests (async server component)
- materials/page.test.tsx: 2 tests (async server component)
- login-data.test.ts: 9 tests (roles, demo profiles)
- role-icon.test.tsx: 4 tests (SVG, a11y)
- locale-path.test.ts: 5 tests (path normalization)
- motion-variants.test.ts: 5 tests (animation data)
- demo-data.test.ts: 7 tests (demo constants)

## Critical Fixes
- useTranslations mock: stable function references per namespace (OOM fix)
- test_tenant_context: HS256-signed JWTs with dev secret
- exports/page.test.tsx: removed importActual causing OOM
- JWT middleware: dev-secret fallback with proper HS256 verification
- Demo mode: _require_demo_mode guard fix
- Sidebar: admin profile detection for super_admin/school_admin

## Totals: 3,781 tests (1,378 frontend + 2,403 backend), 0 failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nhanced focus states

Frontend: floating A11yStatusBadge shows active persona + features count,
PersonaExplainer banner explains current theme adaptations, theme color preview
chips on preferences panel, WCAG-compliant focus with outline+offset and
forced-colors support. 19 new tests (11 badge + 8 explainer), 13 i18n keys
across EN/PT-BR/ES.

Backend: GET /capabilities public endpoint returning platform feature
availability (LLM, TTS, image gen, vector search, braille, skills, demo mode),
config validation at startup, /capabilities excluded from rate limiting and
tenant context middleware. 3 new API tests.

All tests green: 2,406 backend + 1,397 frontend. TypeScript 0 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
FEATURES.md: Added F-223 to F-229 (improvements branch features).
TODO.md: Sprint 27 "Production-Grade Polish" plan — 13 features in 4 phases
(backend hardening, frontend premium polish, API/observability, cleanup).
Based on GPT-5.2 backend architecture + frontend UX expert reviews.
CHANGELOG.md: v0.13.0 entry with all changes from improvements branch.
SYSTEM_DESIGN.md: Capabilities discovery endpoint + accessibility status system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ThemeCompareSlider: draggable split-pane comparing standard theme vs
active persona theme. Shows sample content (card, heading, button,
badges) rendered with each theme's CSS variables inline. Keyboard
accessible (Arrow Left/Right), clamped 5-95%, ARIA slider role.
Integrated into Settings > Accessibility section.

14 tests, 4 i18n keys across EN/PT-BR/ES. TypeScript 0 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- api.ts: VALID_DEMO_PROFILES includes both short (login page) and long
  (landing page) format keys to match backend demo_profiles.py
- evidence-panel.tsx: add missing id attr on toggle button so
  aria-labelledby="evidence-btn-{id}" resolves correctly
- preferences-panel.tsx: fix stale-closure focus-restore bug by using
  direct branch instead of useEffect cleanup
- auth.py: mint iss/aud claims in JWT when AILINE_JWT_ISSUER /
  AILINE_JWT_AUDIENCE env vars are configured

Tests: 2,406 backend + 1,411 frontend = 3,817 green, 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Backend:
- POST /auth/demo-login: proper JWT flow with short/long key aliases
- Demo users seeded with hashed password (demo123) for email login
- /auth/demo-login excluded from tenant middleware
- Login rate limit raised to 20/min for demo-friendly Docker testing
- 7 new demo-login tests (all profiles, short aliases, JWT validity)

Frontend:
- Landing + login pages upgraded to use /auth/demo-login (JWT-first, X-Teacher-ID fallback)
- Pipeline SVG connectors with dash-flow animation on active edges
- Node glow effects (active=warning, completed=success, failed=error)
- btn-press micro-interaction (scale 0.97 on active)
- Motor accessibility (F-235): pill-shaped buttons, 3px focus halos,
  8px tap zone indicators, bottom action bar padding
- demoLogin() async helper in api.ts with auth store integration

Infra:
- Frontend Docker memory 512M → 2G
- NODE_OPTIONS=--max-old-space-size=1536
- Healthcheck fallback: wget || curl

Tests: 2,413 backend + 1,411 frontend = 3,824 green, 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Teacher Journey and Accessibility Showcase tracks with rich
storyboard panel, step navigation, track badges, and full i18n
(EN/PT-BR/ES). Fix startDemo() signature, demoLogin mock, and
TS cast in api.ts. 1,426 frontend + 2,413 backend tests green.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-230)

- Add SessionFactoryUserRepository (session-per-call, mirrors SkillRepo pattern)
- Add DI wiring in app.py (_wire_user_repo) with PostgreSQL guard
- Remove asyncio.Lock from auth endpoints (Postgres handles concurrency)
- Add seed_demo_users_async() for Postgres lifespan seeding
- Add set_user_repo/is_user_repo_set helpers for DI injection
- Update _reset_auth_store() to create fresh InMemory between tests
- 5 new tests: protocol compliance, wiring helpers, async seeding

Backend: 2,413 passed | Frontend: 1,411 passed | 0 lint/type errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- MotorStickyToolbar component: scroll-to-top, font +/-, focus toggle
- Only renders when motor persona is active (theme === 'motor')
- Positioned above MobileNav with z-40, backdrop-blur glass effect
- All buttons 56px min with pill-shape, aria-pressed for focus toggle
- Wired into (app) layout between main content and MobileNav
- Full i18n: EN, PT-BR, ES (motor_toolbar namespace)
- 12 tests covering render/hide, actions, disabled states, aria

Frontend: 156 files, 1,438 tests | 0 type errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… F-238)

- Extract _get_skills_info() helper with module-level cache (F-241)
- Replace duplicate SkillRegistry().scan_paths() in /health/diagnostics and /capabilities
- Skills scanned once per process lifetime (GIL-protected atomic dict replace)
- Mark F-238 (RFC 7807) as done — already fully implemented in error_handler.py

Backend: 32 health/diagnostics tests passing | 0 type errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…(F-240)

- Reset auth _user_repo + _login_attempts in test_skills_v1_api and
  test_tenant_context fixtures to prevent cross-module state pollution
- Add DeprecationWarning to legacy get_config() (F-240)
- Update test_config_extended to expect deprecation warning
- All 2,418 backend tests passing, 0 flaky failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…c-ai >=1.62.0

Frontend:
- tailwindcss 4.1.18 → 4.2.0
- @tailwindcss/postcss 4.1.18 → 4.2.0
- motion 12.34.0 → 12.34.2 (a11y fixes)
- next-intl 4.8.2 → 4.8.3

Backend:
- pydantic-ai >=1.58.0 → >=1.62.0
- uvicorn ==0.40.0 → >=0.41.0,<1
- fastapi ==0.129.0 → >=0.129.0,<1

All 3,856 tests green (2,418 backend + 1,438 frontend), 0 TS errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-239)

F-232: Health Diagnostics Split
- /health/diagnostics is now PUBLIC (no auth): returns status,
  dependency availability (no latency), skill count, uptime, env, version
- /internal/diagnostics requires authentication: returns full operational
  data (latency, LLM config, API key presence, skill names, memory)
- Added /health/diagnostics to _EXCLUDED_EXACT in tenant middleware

F-239: TenantContext Explicit Dependencies
- Eliminated _resolve_teacher_id() anti-pattern from all 4 routers:
  plans.py, plans_stream.py, materials.py, tutors.py
- All endpoints now use Depends(require_authenticated) in signatures
- OpenAPI docs now correctly show auth requirements for all endpoints
- Updated test_error_handler.py to pass auth headers for 422 tests

2,424 backend tests green, 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-237)

- Added `created_at`, `user_prompt`, `subject` fields to RunTrace entity
- TraceStore.get_or_create() now sets ISO 8601 created_at timestamp
- Pipeline persists user_prompt + subject on trace at run start
- New /runs router:
  - GET /runs — list runs with ?status=running|completed|failed filter,
    limit/offset pagination, tenant-scoped
  - GET /runs/{run_id} — full run detail with trace data
- 16 new tests covering list, detail, filtering, pagination, tenant isolation
- 2,440 backend tests green, 0 failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ut endpoint (F-231)

- _create_jwt() now selects RS256 (AILINE_JWT_PRIVATE_KEY) or HS256 (AILINE_JWT_SECRET)
  with dev fallback; every token includes a jti (uuid4) claim
- POST /auth/logout blacklists jti in Redis with TTL = remaining token lifetime
- Middleware checks jti_blacklist:{jti} on every authenticated request (fail-open)
- Settings.jwt_access_ttl_seconds configurable TTL (default 15min prod, 24h dev)
- 5 new tests: jti presence, jti uniqueness, logout ok/auth-required/graceful
- Lint fixes: ternary TTL, unused imports/vars, stale noqa directives

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ync (F-251→F-271)

Phase 1 — Security Containment (6 fixes):
- F-251: Block admin role escalation via demo-login (_validate_role enforcement)
- F-252: TraceStore no longer auto-creates traces from append_node/update_run
- F-253: AILINE_DEV_MODE defaults to false in Docker Compose
- F-254: Shared jwt_dev_secret module replaces hardcoded JWT secrets
- F-255: Per-IP rate limiting on demo-login endpoint (20 req/min)
- F-256: Diagnostics endpoint restricted to admin-only access

Phase 2 — Reliability & Hardening (8 fixes):
- F-257: Rate limiter docstrings aligned (5→20 attempts/minute)
- F-258: EventBus.get_redis_client() protocol method replaces private _redis access
- F-259: TraceStore.list_recent() server-side status filtering
- F-260: Seed imports unified to demo_profiles module
- F-261: _validate_role() raises HTTP 422 for invalid roles (was silent default)
- F-262: plans_stream body immutability via Pydantic model_copy
- F-263: sessionStorage JWT cleanup — removed insecure fallback
- F-264: Docker DB/Redis ports bound to 127.0.0.1

Phase 3 — Docs & i18n Sync (7 fixes):
- F-265: SYSTEM_DESIGN.md version drift fixed (Tailwind, motion, next-intl, pydantic-ai)
- F-266: FEATURES.md Sprint 27 section added
- F-267: SECURITY.md roles updated to 5 (super_admin→parent)
- F-268: RUN_DEPLOY.md port defaults fixed
- F-269: TEST.md counts and commands updated
- F-270: frontend/CLAUDE.md versions synced
- F-271: i18n diacritics fixed (7 pt-BR, 1 es)

Evidence: 2,451 backend tests + 1,438 frontend tests = 3,889 total, 0 failures
Lint: ruff clean, TypeScript clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… tests green

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…258/F-261/F-259)

- F-258: Replace getattr(event_bus, "_redis") in _check_redis() with
  public event_bus.get_redis_client() protocol method (app.py)
- F-261: _validate_role() return type str → UserRole for type precision
- F-259: Fix docstring "cursor-based" → "offset-based" pagination (runs.py)

Evidence: 2,451 backend tests passed, ruff clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ofiles

- SYSTEM_DESIGN.md: WebSocket path /ws/accessibility/libras → /sign-language/ws/libras-caption
- SYSTEM_DESIGN.md: demo profiles 8→6 (admin profiles removed in F-251)
- SYSTEM_DESIGN.md: structlog 25.4.0→25.5.0, aiosqlite 0.21.0→0.22.1
- SYSTEM_DESIGN.md: pydantic-ai >=1.62.0→>=1.58.0 (align with lockfile)
- SECURITY.md: "All API endpoints" → "All business/data endpoints" + public exceptions
- RUN_DEPLOY.md: db/redis ports now 127.0.0.1:5411/6311 (matches F-264)
- runtime/pyproject.toml: pydantic-ai constraint >=1.62.0→>=1.58.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…factor, UI components, sprint planning

- Security fixes: composite FK/unique constraints migration, security test suite
- Backend: skill repository with proper pagination/filtering, progress store improvements, auth router enhancements
- Frontend: bento dashboard layout, button/card UI components, SSE fetch library, ESLint config updates
- Dependencies: bump agents and runtime packages, update lock files
- Docs: TODO backlog update, FEATURES sync, reference guides (context management, prompt caching, skills)
- Sprint plans: Sprints 29-37 planned (design system, production readiness, architecture evolution, performance, safety, AI intelligence, personalization, UX/accessibility)
- CI: workflow updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 4, 2026 14:52
@rafaelob
rafaelob merged commit 565dc3f into main Mar 4, 2026
1 of 8 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bundles a broad set of sprint changes spanning a reference “context management” Python module + docs, frontend accessibility/UI upgrades (including demo flows), SSE client refactor, and infrastructure/security hardening.

Changes:

  • Add contextkit reference module (budgets X/Y, rolling summary, skills registry, tool artifact handling, RAG evidence packs, graph memory) and accompanying playbook/docs/templates.
  • Frontend a11y/UX upgrades (focus styles, motor toolbar, persona explainer/status badge, theme compare slider, i18n strings), plus extensive Vitest coverage.
  • Security/infrastructure updates (demo-login JWT flow, docker-compose port binding hardening, CI audits set to fail, dependency bumps).

Reviewed changes

Copilot reviewed 158 out of 270 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/util/truncation.py Adds truncation helpers used by the reference module for budgeted excerpts.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/util/json_redact.py Adds simple secret/PII redaction used before persisting/printing payloads.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/types.py Introduces core conversation/tool datatypes for compaction and assembly.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/tool_context_manager.py Adds artifact store + tool result summarization/compaction pipeline.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/token_count.py Adds token counting abstractions (heuristic + optional tiktoken + provider API).
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/skills_registry.py Adds progressive skill discovery/activation based on SKILL.md frontmatter.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/rolling_summary.py Adds rolling summary manager with LLM-pluggable + deterministic fallback.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/rag/rag_manager.py Adds simple wrapper for web search retrieval into EvidencePacks.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/rag/evidence_pack.py Adds EvidencePack datatypes + compression + context snippet rendering.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/rag/init.py Exposes RAG public API from the rag subpackage.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/orchestrator.py Adds a minimal orchestrator tying budgets, rolling summary, skills, and tool packing together.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/memory/memory_manager.py Adds a high-level memory manager writing to a graph store with TTL/provenance.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/memory/init.py Exposes memory public API entries.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/mcp_registry.py Adds minimal MCP server/tool registry + tool catalog snippet generation.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/config.py Centralizes configuration/policies for X/Y budgets, history, skills, tools, RAG, storage.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/init.py Defines contextkit package exports for the reference module.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/pyproject.toml Adds Python packaging metadata + optional deps for the reference module.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/examples/skills/web-research/SKILL.md Adds example skill for web research with EvidencePack output constraints.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/examples/skills/mcp-tool-discovery/SKILL.md Adds example skill for MCP tool discovery with progressive disclosure.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/examples/demo_minimal.py Adds runnable demo showcasing compaction + budgets + tool blocks.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/examples/demo_config.yaml Adds sample config values for the demo.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/REFERENCIAS_OFICIAIS.md Adds dated list of official sources consulted for the playbook update.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/REFERENCIAS.md Adds local reference index pointing to official references.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/CHANGELOG.md Adds playbook changelog capturing the 2026-02-24 update.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/07_templates.md Adds reusable templates for rolling summary/tool summaries/evidence packs/skill skeleton.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/06_checklists.md Adds production checklists for context/tools/MCP/skills/memory/security/ops.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/02_reference_module.md Documents the Python reference module components and integration guidance.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/docs/00_GUIDE_COMPLETO.md Adds updated “complete guide” overview for X/Y approach.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/README.md Adds playbook README describing features and entry points.
references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/LICENSE Adds MIT license text for the upstream playbook snapshot.
references/Context_Management_Pack_GUIDE/templates/tool_contract_template.md Adds a tool contract template (design spec).
references/Context_Management_Pack_GUIDE/templates/system_prompt_single_agent.md Adds system prompt template for single-agent setups.
references/Context_Management_Pack_GUIDE/templates/system_prompt_manager_agent.md Adds system prompt template for multi-agent manager setups.
references/Context_Management_Pack_GUIDE/templates/summary_prompt_tool_result.md Adds structured prompt template for tool result compaction.
references/Context_Management_Pack_GUIDE/templates/summary_prompt_conversation.md Adds structured prompt template for conversation summary updates.
references/Context_Management_Pack_GUIDE/templates/rag_evidence_pack_template.md Adds YAML template for evidence packs.
references/Context_Management_Pack_GUIDE/templates/handoff_package_schema.json Adds JSON schema for handoff packages v1.
references/Context_Management_Pack_GUIDE/templates/handoff_contract_schema_v2.json Adds JSON schema for dual-mode handoff contract v2.
references/Context_Management_Pack_GUIDE/manifest.json Adds manifest describing the shipped pack contents.
references/Context_Management_Pack_GUIDE/docs/14_ROTEIRO_30_60_90.md Adds 30/60/90 adoption roadmap + DoD.
references/Context_Management_Pack_GUIDE/docs/13_ANTI_PADROES.md Adds anti-patterns and corrections for context management.
references/Context_Management_Pack_GUIDE/docs/09_MEMORIA_E_COMPACCAO.md Adds memory + compaction guidance + safe restart patterns.
references/Context_Management_Pack_GUIDE/docs/08_RAG_EVIDENCE_PACK.md Adds RAG evidence pack guidance (compression, citations, safety).
references/Context_Management_Pack_GUIDE/docs/06_HISTORICO_POR_TOKENS.md Adds token-budgeted history management guidance.
references/Context_Management_Pack_GUIDE/docs/00_INDEX.md Adds navigation index for the context management pack docs.
references/Context_Management_Pack_GUIDE/configs/observability_config.yaml Adds example observability configuration (ledger/tracing/metrics).
references/Context_Management_Pack_GUIDE/configs/budget_profiles.schema.json Adds schema for validating budget profile definitions.
references/Context_Management_Pack_GUIDE/code/examples/example_tool_result_compaction.py Adds example script for digest+pointer tool result compaction.
references/Context_Management_Pack_GUIDE/code/examples/example_handoff.py Adds example script illustrating delegate vs transfer handoff packages.
references/Context_Management_Pack_GUIDE/code/examples/example_budgeted_assembly.py Adds example script assembling context slices using budget profiles.
references/Context_Management_Pack_GUIDE/code/README.md Documents the scaffold code and integration steps.
references/Context_Management_Pack_GUIDE/README.md Adds pack-level README describing docs/templates/configs/code and quickstart.
frontend/src/styles/globals.css Improves focus styling, motor theme affordances, and micro-interactions/animations.
frontend/src/stores/demo-store.test.ts Updates demo store tests for multi-track demo onboarding and step helpers.
frontend/src/stores/auth-store.test.ts Adds auth store tests including persistence/XSS mitigation expectations.
frontend/src/messages/es.json Adds/updates Spanish strings (a11y panels, demo tracks/steps, toolbar).
frontend/src/messages/en.json Adds/updates English strings (a11y panels, demo tracks/steps, toolbar).
frontend/src/lib/sse-fetch.ts Adds local SSE fetch-based client to replace external dependency.
frontend/src/lib/motion-variants.test.ts Adds tests for motion variants objects.
frontend/src/lib/locale-path.test.ts Adds tests for locale path helper.
frontend/src/lib/demo-data.test.ts Adds tests for demo constants.
frontend/src/lib/api.ts Adds demo-login helper + expands demo profile allowlist; cleans legacy tokens on load.
frontend/src/hooks/use-tutor-sse.ts Switches tutor SSE hook to the new internal SSE client.
frontend/src/hooks/use-tutor-sse.test.ts Updates mocks for new SSE client import path.
frontend/src/hooks/use-pipeline-sse.ts Switches pipeline SSE hook to the new internal SSE client.
frontend/src/hooks/use-pipeline-sse.test.ts Updates mocks for new SSE client import path.
frontend/src/components/ui/illustrations/success-celebration.tsx Adds reusable clay-style SVG illustration component.
frontend/src/components/ui/illustrations/persona-avatars.tsx Adds persona avatar SVG component for demo/profile UI.
frontend/src/components/ui/illustrations/onboarding-welcome.tsx Adds onboarding welcome illustration.
frontend/src/components/ui/illustrations/loading-state.tsx Adds loading-state illustration.
frontend/src/components/ui/illustrations/error-gentle.tsx Adds gentle error illustration.
frontend/src/components/ui/illustrations/empty-state.tsx Adds empty-state illustration.
frontend/src/components/ui/illustrations/base-clay-svg.tsx Adds base SVG wrapper with a11y metadata and shared filters/gradients.
frontend/src/components/ui/card.tsx Adds Card primitive with variants for bento/dashboard layouts.
frontend/src/components/ui/button.tsx Adds Button primitive with variants/sizes and focus/active states.
frontend/src/components/shared/demo-tooltip.test.tsx Updates demo tooltip tests for multi-track onboarding and navigation buttons.
frontend/src/components/plan/plan-generation-flow.tsx Starts demo in teacher track when demo query param triggers guided flow.
frontend/src/components/plan/pipeline-visualization.tsx Adds animated SVG connectors and status glows to pipeline visualization.
frontend/src/components/plan/evidence-panel.tsx Fixes aria-controls/linkage by adding missing button id.
frontend/src/components/layout/sidebar.tsx Adds Accessibility nav entry + icon.
frontend/src/components/layout/bento-dashboard.tsx Adds a bento dashboard layout skeleton.
frontend/src/components/landing/landing-demo-login.tsx Makes landing demo login attempt JWT-based auth with fallback to header.
frontend/src/components/auth/role-selection-phase.test.tsx Adds tests for role selection phase interactions and a11y.
frontend/src/components/auth/role-icon.test.tsx Adds tests for role icon SVG rendering/a11y.
frontend/src/components/auth/login-form-phase.tsx Allows demo login callback to be async.
frontend/src/components/auth/login-data.ts Removes admin demo profiles to reduce privilege escalation risk.
frontend/src/components/auth/login-data.test.ts Adds tests enforcing non-admin demo profiles and profile fields.
frontend/src/components/accessibility/theme-compare-slider.test.tsx Adds tests for theme comparison slider keyboard/a11y behavior.
frontend/src/components/accessibility/preferences-panel.tsx Fixes focus restore logic and adds theme preview swatches.
frontend/src/components/accessibility/persona-explainer.tsx Adds persona explainer banner with aria-live announcements.
frontend/src/components/accessibility/persona-explainer.test.tsx Adds tests for persona explainer behavior and mappings.
frontend/src/components/accessibility/motor-sticky-toolbar.test.tsx Adds tests for motor toolbar rendering and actions.
frontend/src/components/accessibility/a11y-status-badge.test.tsx Adds tests for status badge expansion, counting, and dismissal behavior.
frontend/src/app/[locale]/login/page.tsx Updates demo login to attempt JWT auth with fallback behavior.
frontend/src/app/[locale]/(app)/settings/settings-content.tsx Adds ThemeCompareSlider to settings page.
frontend/src/app/[locale]/(app)/settings/settings-content.test.tsx Adds tests for settings page content and landmarks.
frontend/src/app/[locale]/(app)/settings/page.test.tsx Adds tests for settings route component wrapper.
frontend/src/app/[locale]/(app)/progress/page.test.tsx Adds tests for progress page wrapper.
frontend/src/app/[locale]/(app)/materials/page.test.tsx Adds tests for materials page wrapper.
frontend/src/app/[locale]/(app)/layout.tsx Adds persona explainer, motor toolbar, and a11y status badge to app layout.
frontend/src/app/[locale]/(app)/exports/page.test.tsx Simplifies next/navigation mocking to reduce test overhead/OOM.
frontend/src/tests/setup.ts Fixes next-intl mock to return stable function references per namespace.
frontend/package.json Removes external SSE dep, bumps key frontend deps, and updates pnpm version.
frontend/eslint.config.mjs Migrates ESLint config to defineConfig + global ignores.
frontend/CLAUDE.md Updates documented versions/conventions and notes custom SSE client.
docker-compose.yml Hardens port bindings, bumps pgvector image, and adjusts frontend memory/healthcheck.
control_docs/TEST.md Updates test counts and docker test command.
control_docs/SECURITY.md Updates authz policy descriptions, roles, and public endpoint exceptions.
control_docs/RUN_DEPLOY.md Updates default ports and docker compose service table and notes.
control_docs/CHANGELOG.md Adds sprint changelog entries for 0.13.0 and 0.14.0.
agents/pyproject.toml Bumps agent dependencies and moves lint/type targets to Python 3.13.
.github/workflows/ci.yml Makes dependency audits fail CI and adds security-scan dependency to docker-build.
.env.example Adds JWT secret guidance and changes demo/dev mode defaults.
Files not reviewed (1)
  • frontend/pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (8)

references/Context_Management_Pack_GUIDE/upstream/context_memory_playbook_original/context_memory_playbook/src/contextkit/util/truncation.py:3

  • Tuple is imported but not used in this module. Removing it avoids lint noise and keeps the reference implementation clean.
from typing import Tuple

frontend/src/lib/sse-fetch.ts:109

  • For non-OK responses (e.g., 401/403/500) the function returns silently, which can make callers treat failures as normal stream termination. Consider throwing an error (or calling onerror) when !response.ok, and also handle the !response.body case explicitly so SSE failures are surfaced reliably.
  // If the response isn't OK and onopen didn't throw, bail out
  if (!response.ok || !response.body) return

frontend/src/lib/sse-fetch.ts:8

  • The header comment claims support for automatic retry with back-off, and openWhenHidden, but the implementation does not implement retries/backoff or any visibility handling. Either implement the promised behaviors or update the comment/API docs to match actual supported features.
/**
 * Lightweight SSE client using native fetch + ReadableStream.
 * Drop-in replacement for @microsoft/fetch-event-source with the same
 * callback-based API but zero external dependencies.
 *
 * Supports POST (and any HTTP method), custom headers, AbortController,
 * automatic retry with back-off, and openWhenHidden.
 */

frontend/src/lib/sse-fetch.ts:44

  • SSE commonly uses CRLF (\\r\\n) line endings per spec. Splitting only on \\n / \\n\\n can cause parsing issues (e.g., fields include trailing \\r, event boundaries aren’t detected). Normalize newlines (e.g., replace \\r\\n with \\n) or split using \\r?\\n and \\r?\\n\\r?\\n patterns.
  for (const raw of block.split('\n')) {

frontend/src/lib/sse-fetch.ts:124

  • SSE commonly uses CRLF (\\r\\n) line endings per spec. Splitting only on \\n / \\n\\n can cause parsing issues (e.g., fields include trailing \\r, event boundaries aren’t detected). Normalize newlines (e.g., replace \\r\\n with \\n) or split using \\r?\\n and \\r?\\n\\r?\\n patterns.
      const parts = buffer.split('\n\n')

frontend/src/components/accessibility/preferences-panel.tsx:72

  • Focus restore now only happens when open transitions to false. If the panel unmounts while still open (e.g., navigation/route change), focus won’t be restored. Consider adding a cleanup that restores focus on unmount when open is true and previousFocusRef.current is set, to preserve expected keyboard accessibility.
  useEffect(() => {
    if (open) {
      previousFocusRef.current = document.activeElement as HTMLElement | null
    } else if (previousFocusRef.current) {
      previousFocusRef.current.focus()
      previousFocusRef.current = null
    }
  }, [open])

frontend/src/stores/auth-store.test.ts:117

  • This test does not actually validate rehydration behavior (it has no assertion that user was cleared; it also doesn’t trigger zustand persist rehydration, and the expect(true).toBe(true) is a no-op). Recommend asserting the observable outcome by triggering rehydration (e.g., re-importing the store after setting localStorage, or exposing/forcing persist rehydrate in the test) and then checking user === null when token is absent.
  it('onRehydrate clears stale user when token is absent', () => {
    // Simulate stale persisted state (user present, token absent)
    localStorage.setItem(
      'ailine-auth',
      JSON.stringify({
        state: { user: MOCK_USER },
        version: 0,
      }),
    )

    // Force rehydration by re-creating store state
    // The onRehydrateStorage callback should clear user when token is null
    const state = useAuthStore.getState()
    // After rehydration without token, user should be wiped
    if (!state.token && state.user) {
      // This simulates the rehydration logic
      expect(true).toBe(true) // The store handles this internally
    }
  })

.env.example:75

  • The example environment enables AILINE_DEV_MODE and AILINE_DEMO_MODE by default while leaving AILINE_JWT_SECRET empty. If someone uses this as a baseline for a real deployment, it increases the chance of running with insecure auth bypass/demo features. Consider defaulting dev/demo flags to false in the example, and/or adding a prominent warning comment near these variables that production must set a strong JWT secret and disable dev/demo modes.
AILINE_JWT_SECRET=""

# === Dev Mode (enables X-Teacher-ID header bypass for local dev) ===
AILINE_DEV_MODE="true"

# === Demo Mode (enables /demo/* endpoints and demo login) ===
AILINE_DEMO_MODE="1"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +27 to +30
digest = hashlib.sha256(raw.encode("utf-8")).hexdigest()[:16]
ext = "json" if is_structured else "txt"
path = self.artifacts_dir / f"{tool_name}_{digest}.{ext}"
path.write_text(raw, encoding="utf-8")

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact filenames are built directly from tool_name. If tool_name can contain path separators or .., this can lead to writing outside artifacts_dir or failing on invalid filenames. Sanitize tool_name (e.g., allowlist [A-Za-z0-9_-], replace others with _, and cap length) before constructing the path.

Copilot uses AI. Check for mistakes.
@rafaelob
rafaelob deleted the sprint-26-comprehensive-review-and-improvements branch March 10, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants