## PollPredict Repository Rules ### Repository Role and Legacy Build Exception - This is a legacy Java 8, Spring Boot 2.2, JSP, MyBatis, MSSQL WAR application for exit-poll prediction and transmission workflows. - The repository's existing Maven Wrapper is the approved legacy-maintenance exception to the shared Gradle standard. Use `mvnw` for current maintenance only; do not use a machine-global Maven installation. - Do not add new Maven modules or treat Maven as the target architecture. New or migrated Spring Boot components must use the approved Gradle-based project structure. - Preserve current JSP routes, Spring Security behavior, WAR packaging, MyBatis mappings, Java version, and dependency constraints until an approved migration slice changes them. ### SQL-Centric Architecture Improvement - Large mapper SQL, especially analysis and transmission queries, is a primary improvement target. The risk is calculation and orchestration responsibility concentrated in SQL, not evidence of literal MyBatis parameter substitution. - Before decomposing a query, capture its parameters, result columns, row counts, ordering, null handling, date behavior, grouping, totals, rounding, and downstream JSP or export assumptions. - Separate data retrieval, normalization, domain calculation, prediction/statistical processing, and presentation in small verified slices. - Preserve `#{...}` parameter binding. Do not replace mapped queries with string-built SQL or broad in-memory processing without representative performance and equivalence evidence. - Treat files under `src/main/resources/old_m` as reference material until runtime usage and removal criteria are established. ### Full-Stack Migration Direction - The approved destination is a Gradle-based Spring Boot backend and Next.js/TypeScript frontend. - Migrate one bounded workflow at a time while keeping legacy JSP and MyBatis behavior compatible until replacement acceptance criteria are met. - Separate framework migration from intentional prediction, statistical, or product behavior changes so each can be verified independently. ### Harness and Verification - `AGENTS.md` and `CLAUDE.md` are generated. Edit `.agent/profile.yml` or `.agent/project.md`, then recompose instead of editing generated files. - Use the Maven Wrapper only for narrow validation of the current legacy application. Do not start the application or connect to a real MSSQL database during validation without separate approval.