feat(export): export templates model, CRUD, and candidate resolution - #340
Merged
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
budget-feat-313-excel-export: addsExportTemplateModelwith a seeded "GrandFlow Default" template, CRUD scoped to the caller's organisation (updates bumpversion; 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), andGET /budgets/{id}/export-templates.is_system_defaultflag, a partial unique index that allows at most one flagged row, and a CHECK tying the flag to a NULL owner. Without these, Postgres'sUNIQUE(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.ast/tokenize, so multi-line string literals such as SQL are no longer flagged, and generated migration headers are exempt.flow.pygains acleanupsubcommand, andflow.py prnow warns when user-facing frontend code changed butdocs/user-guide/didn't.Test plan
services/budgetexport-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 integrationservices/budgetandscripts/: black, mypy, flake8,scripts/test_flow.pyalembic upgrade head/downgrade -1against dev Postgres (000018: backfill runs before the CHECK and index are added)🤖 Generated with Claude Code
Closes #323