feat: update contract_version in sign endpoint to read from config #38

Closed
opened 2026-04-03 23:51:48 +00:00 by forgejo_admin · 2 comments
Contributor

Type

Feature

Lineage

Sub-ticket of forgejo_admin/westside-contracts#34 — data-driven contract rendering system. Wave 3.

Repo

forgejo_admin/westside-contracts

User Story

As the contract signing system, I need to derive the contract_version from the team's contract_config instead of hardcoding version strings based on team name patterns.

Context

The sign endpoint (src/routes/contract/[token]/sign/+server.ts) currently determines contract_version by checking if team name includes "Local" or "Queens":

const contractVersion = isLocal ? '2026-spring-local-v1' : isGirls ? '2026-spring-girls-travel-v1' : '2026-spring-travel-v1';

With contract_config on teams, the variant and season are in the data. Read from there, keep the current logic as fallback when contract_config is NULL.

File Targets

  • src/routes/contract/[token]/sign/+server.ts — update contract version derivation

Files NOT to touch:

  • src/lib/validation.ts, src/lib/minio.ts, src/lib/db.ts
  • src/routes/contract/[token]/+page.svelte

Acceptance Criteria

  • When team has contract_config: version derived from config.season + config.variant (e.g. "2026-spring-girls-travel-v1")
  • When team has no contract_config: falls back to current team-name-based logic
  • Signing flow works end-to-end with both paths
  • contract_version is correctly written to player record

Test Expectations

  • Manual: sign a test contract, verify contract_version in DB
  • Existing tests pass: npm test
  • Run command: npm test && npm run check

Constraints

  • Must be backwards compatible — NULL config = current behavior
  • Version string format should remain consistent with existing signed records

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • westside-basketball — parent project
  • forgejo_admin/westside-contracts#34 — parent issue
  • Depends on: data-driven +page.server.ts ticket
### Type Feature ### Lineage Sub-ticket of `forgejo_admin/westside-contracts#34` — data-driven contract rendering system. Wave 3. ### Repo `forgejo_admin/westside-contracts` ### User Story As the contract signing system, I need to derive the contract_version from the team's contract_config instead of hardcoding version strings based on team name patterns. ### Context The sign endpoint (`src/routes/contract/[token]/sign/+server.ts`) currently determines contract_version by checking if team name includes "Local" or "Queens": ```typescript const contractVersion = isLocal ? '2026-spring-local-v1' : isGirls ? '2026-spring-girls-travel-v1' : '2026-spring-travel-v1'; ``` With contract_config on teams, the variant and season are in the data. Read from there, keep the current logic as fallback when contract_config is NULL. ### File Targets - `src/routes/contract/[token]/sign/+server.ts` — update contract version derivation Files NOT to touch: - `src/lib/validation.ts`, `src/lib/minio.ts`, `src/lib/db.ts` - `src/routes/contract/[token]/+page.svelte` ### Acceptance Criteria - [ ] When team has contract_config: version derived from `config.season` + `config.variant` (e.g. "2026-spring-girls-travel-v1") - [ ] When team has no contract_config: falls back to current team-name-based logic - [ ] Signing flow works end-to-end with both paths - [ ] contract_version is correctly written to player record ### Test Expectations - [ ] Manual: sign a test contract, verify contract_version in DB - [ ] Existing tests pass: `npm test` - Run command: `npm test && npm run check` ### Constraints - Must be backwards compatible — NULL config = current behavior - Version string format should remain consistent with existing signed records ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `westside-basketball` — parent project - `forgejo_admin/westside-contracts#34` — parent issue - Depends on: data-driven +page.server.ts ticket
Author
Contributor

Scope Review: READY

Review note: review-778-2026-04-03
Ticket is fully scoped with verified file targets, complete traceability, and clear acceptance criteria. Single file change in single repo, well within 5-minute rule. Blocked only by wave:1/wave:2 dependencies (T1, T3, T5) currently in QA — dispatch after those are validated and merged.

## Scope Review: READY Review note: `review-778-2026-04-03` Ticket is fully scoped with verified file targets, complete traceability, and clear acceptance criteria. Single file change in single repo, well within 5-minute rule. Blocked only by wave:1/wave:2 dependencies (T1, T3, T5) currently in QA — dispatch after those are validated and merged.
Author
Contributor

Agent picked up this ticket.

Agent picked up this ticket.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/westside-contracts#38
No description provided.