Skip to content

feat(export): export templates model, CRUD, and candidate resolution - #340

Merged
arutsh merged 2 commits into
mainfrom
Budget/feat/Issue-323/excel-export-group5
Sep 25, 2026
Merged

arutsh merged 2 commits into
mainfrom
Budget/feat/Issue-323/excel-export-group5

Conversation

@arutsh

@arutsh arutsh commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Group 5 of budget-feat-313-excel-export: adds ExportTemplateModel with a seeded "GrandFlow Default" template, CRUD scoped to the caller's organisation (updates bump version; editing or deleting the system default returns 403), list_candidate_templates (system default + the caller's own + the funder's shared templates, checked live against the donor-grantee relationship), and GET /budgets/{id}/export-templates.
  • One system default, enforced by the database (migration 000018): a new is_system_default flag, a partial unique index that allows at most one flagged row, and a CHECK tying the flag to a NULL owner. Without these, Postgres's UNIQUE(owner_customer_id, name) treats each NULL owner as distinct, so a second system default could exist, and the listing, update and delete paths would then return 500.
  • Tooling:
    • The comment-brevity hook now blocks only violations a write introduces. For Python it uses ast/tokenize, so multi-line string literals such as SQL are no longer flagged, and generated migration headers are exempt.
    • flow.py gains a cleanup subcommand, and flow.py pr now warns when user-facing frontend code changed but docs/user-guide/ didn't.

Test plan

  • services/budget export-template tests: model constraints (duplicate name, second system default, system default with an owner, ownerless template that isn't the default), CRUD scoping, version bump, system-default guard, candidate resolution, route integration
  • Pre-push lint for services/budget and scripts/: black, mypy, flake8, scripts/test_flow.py
  • alembic upgrade head / downgrade -1 against dev Postgres (000018: backfill runs before the CHECK and index are added)
  • CI green

🤖 Generated with Claude Code

Closes #323

arutsh and others added 2 commits September 25, 2026 14:17
…323)

Group 5 of budget-feat-313-excel-export: ExportTemplateModel with a seeded
system default, scoped CRUD, list_candidate_templates (system + own + funder's
shared, live-gated on the donor-grantee relationship), and
GET /budgets/{id}/export-templates.

The system default is marked by an explicit is_system_default flag (000018),
with a partial unique index allowing at most one and a CHECK tying it to a
NULL owner; a NULL-owner UNIQUE constraint alone let duplicates through and
500'd the listing, update and delete paths.

Tooling: the comment-brevity hook now blocks only newly introduced
violations and uses ast/tokenize for Python so string literals aren't
flagged; flow.py gains `cleanup` and a stale user-guide warning on `pr`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
grant-flow Ready Ready Preview Sep 25, 2026 1:18pm UTC

@arutsh
arutsh merged commit f201a76 into main Sep 25, 2026
27 of 29 checks passed

This branch was successfully deployed

1 active deployment
Preview — 02c39313 Deployed Sep 25, 2026 by vercel[bot]
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.

excel-export: Export templates: model, ownership, and candidate resolution (group 5)

1 participant