Skip to content

release(members): promote spec 50 (membership fees) to production - #287

Merged
PeterGeers merged 18 commits into
mainfrom
test
Nov 30, 2026
Merged

PeterGeers merged 18 commits into
mainfrom
test

Conversation

@PeterGeers

Copy link
Copy Markdown
Owner

Promotes test -> main after a green Full Test Suite on the test tip. This merge is the release: it fires deploy-sam-members (prod stack sam-members) and the production Pages build.

What ships (spec 50 - memberships, .kiro/specs/Members/50 - memberships/)

A member's fee is now a derived, read-only Members calculated field (membership_fee), computed on read from a tenant-authored catalog - no billing, no payment record, no invoices.

  • config#membership_fees catalog (one small record per tenant in the existing governance_projection partition; same partition as config#fields): { registration_fee, periods[] } per membership type, periods { period, fee_per_period, start_date, end_date, split_type }, contiguous + gap-free (validated on write).
  • GET /members/config/membership_fees (members:admin) + the existing whole-object PUT.
  • Derivation: a member joining in the current period -> prorated fee_per_period (HALF_UP, join month full) + registration; existing member -> the current period's fee_per_period, no proration/registration; no covering period -> field absent (never a raise). Decimal money, multiply-before-divide, catalog loaded once per invocation.
  • TenantAdmin Membership fees tab: one row per membership type (vocabulary + catalog), view modal -> explicit Edit, edit modal authors registration + effective-dated period rows and writes the whole catalog; every column filterable + sortable.
  • Docs: sam/members/docs/data-model.md, config-guide.md; spec README added.

No migration and no new infrastructure: the catalog row is created on first write inside the existing governance_projection table, and every change lives under sam/members/** or frontend/**.

Gate evidence

Post-merge checks

  1. Deploy SAM Members on main -> success (prod stack).
  2. Production Pages deploy -> success.
  3. Smoke: prod admin -> Members -> Config -> Membership fees loads the catalog and a save returns {success, configId, version}.
  4. Then archive the spec folder (.kiro convention).

…talog (spec 50)

Add a TenantAdmin-authored fee catalog (config#membership_fees, in
governance_projection) and derive a read-only membership_fee calculated field
per member from its membership_type. No billing or payment: the fee is derived
on read, never stored.

- read: CONFIG_ID_MEMBERSHIP_FEES + _MembershipFeesReadMixin.get_membership_fees,
  composed into MembersProjectionReader (shares the config partition read/cache)
- write: membership_fees on the config write surface + _validate_membership_fees_body
  (Decimal money; non-overlapping, gap-free periods; drops counts_as_member)
- calc: sam/members/domain/membership_fees.py (compute_member_fee, start_rate,
  resolve_price_period, months_active, months_in_period; multiply-before-divide,
  quantize 0.01 HALF_UP)
- field: CalculatedField.context_compute + evaluate(record, context); membership_fee
  registered (origin=calculated, never stored); catalog loaded once per read and
  threaded as fee_catalog; None (never raise) on missing catalog/type/period
- read path: MembershipService(membership_fees_provider=...) + _fee_context()
- i18n: membership_fee label in en/nl admin.json
- tests: reader, write, calc, calcfield, readpath, type-reference regression, and a
  real-data round-trip over the real h-dcn config#fields fixture
- naming: align the DynamoDB table name to test_sam-members across provisioning,
  table design, docs, steering 35 and tests
…view-tweaks under 01

- .kiro/specs/Members/50 - memberships: requirements (R1-R13), design, tasks
  (Tasks 1-10 all done) and the README index row
- move members-overview-tweaks (incl. root-cause-analysis.md) under
  01 - members-config-projection-and-cleanup/
- record the test_sam-members table-naming fix on the s5d activation dev-test
…odals) — spec 50 R14

Adds the authoring surface for `config#membership_fees` on the Members config panel: a
`members:admin` GET seam (`/members/config/membership_fees`) plus a table with ONE ROW PER
membership type (vocabulary options UNION catalog keys), a read-only view modal, and a
Formik + Yup edit modal that writes the WHOLE catalog (sibling types preserved).

- backend: `MembershipService.get_membership_fees()` read seam, route, and dispatch
- frontend: `membershipFeesModel` (rows / current period / period problems / merge / money),
  `MembershipFeesEditor`, `MembershipFeeViewModal`, `MembershipFeeEditModal`, API + types,
  EN/NL copy, new "Membership fees" tab
- fixes found while testing: Chakra inputs are bound with `Field as={Input|Select}` (raw
  `<Input name=…>` is not connected to Formik and rendered empty); no `Center` in this
  Chakra build (loader uses `Box textAlign="center"`)
- tests: `test_membership_fees_route.py` (5) + `membershipFeesModel.test.ts` (13) +
  `MembershipFeesEditor.test.tsx` (5); pytest fee selection 60 passed, vitest 22 passed,
  `tsc --noEmit` and eslint clean
Records the TenantAdmin fee-editor surface that shipped with the derived
`membership_fee` field: the requirement (R14: one row per membership type,
read-only view → explicit edit, whole-object save, SAM as the authority),
the design section (vocabulary ⊕ catalog rows, mirror of the Members modal
flow, `Field as={Input|Select}` binding), and Task 11 (read seam / surface /
tests) with its wave in the dependency graph.
… harness (spec 50)

The new fee-catalog read route changed the route-map invariants (52 total, MEMBER 17) and
was not exercised by the h-dcn parity walkthrough — the same class of staleness the
`sam-stale-tests-after-code-changes` spec documented for `ai_improve_template`.

- `test_members_routes.py`: counts 51→52 and MEMBER 16→17 (+ the running derivation
  comment) and `get_membership_fees` in the named-behaviour set
- `members_parity_harness.py`: a walkthrough step for GET /members/config/membership_fees
  (members:admin; the harness wires no fee provider, so 200 + empty catalog)
feat(members): membership_fee derived from config#membership_fees catalog (spec 50)
…ec 50 R14.9)

"Add period" seeded the CURRENT calendar year. Against an existing 2026 period that range
overlaps it, so the contiguous/gap-free rule (client Yup test + the SAM validator) rejected
the form instantly: Save was blocked and the catalog looked locked to ONE period even though
`periods[]` is explicitly effective-dated (R2.3/R5).

- `membershipFeesModel`: `defaultPeriod()` (calendar-year season default, moved out of the
  modal) and `nextPeriodAfter(periods)` — start = previous end_date + 1 day, end = 31 Dec of
  that year, fee + split_type inherited, label `2027` (or `2026-07` for a mid-season split).
- `MembershipFeeEditModal`: the add button pushes `nextPeriodAfter(values.periods)` and is
  `type="button"` (explicit, inside the Formik <Form>); fee/start/end inputs gained test ids.
- tests: model 13→18 (`defaultPeriod`, contiguous append, mid-season split, unsorted input,
  gap-free assertion) and editor 5→6 (Add period → second row seeded 2027-01-01..2027-12-31
  with 77.90 → Save writes BOTH periods, sibling type preserved).
- spec: R14.9 (multiple periods SHALL be authored, contiguous seeding), design "Period
  authoring — append, never overlap", tasks 11.2/11.3 updated.

Verified: vitest 24 passed, `tsc --noEmit` clean, eslint clean.
fix(members): author multiple fee periods via a contiguous append (spec 50 R14.9)
… R14.9)

On TEST the editor read as "there is no add" because the control was a low-contrast ghost
button BELOW the scrolling periods table (size="xl" + scrollBehavior="inside").

- The `+ Add period` button now sits beside the "Periods" heading, `variant="outline"` /
  `colorScheme="orange"` (still `type="button"`, still pushing `nextPeriodAfter(values.periods)`).
- New helper line under the heading (`periods_hint`, EN/NL): periods must be contiguous and the
  period covering today is the one the member fee uses — that is why changing a lone period to
  2027 makes the 2026 "current period" columns read empty.
- Empty state row ("no periods yet") when a type has `periods: []`.
- Seeding tightened: an EXISTING entry with `periods: []` keeps it empty (the derived fee is then
  None); only a not-yet-configured type is seeded one calendar-year period.
- test: `shows the Add period affordance + empty state for a type with no periods` (6 → 7 editor
  tests); the add-period test still asserts the contiguous 2027 seeding + two-period save.

Verified: vitest 32 passed (model 18, editor 7, translations 7), `tsc --noEmit` clean, eslint clean.
fix(members): make Add period unmissable in the fee editor (spec 50 R14.9)
…n Configured (spec 50)

Reported on TEST: moving a type's only period to 2027 left the "Current period" columns empty while
the row still showed a green "Configured" badge — the row looked broken rather than effective-dated.

- The badge is now a tri-state: **missing** (gray, no catalog entry) / **current** (green, a period
  covers today) / **no period for today** (yellow, `status_no_current` EN+NL).
- `data-state` + `membership-fees-status-<type>` test ids expose the state.
- test: a 2027-only catalog and a `periods: []` entry both render `data-state="future"`.
- spec: tasks 11.2 records the tri-state rationale.

Verified: editor 7 -> 8 tests, translations 7 (15 passed), `tsc --noEmit` clean, eslint clean.
fix(members): fee status distinguishes "no period for today" (spec 50)
…pec 50)

TEST feedback on the fee edit modal:

- **Black-on-black Cancel.** Chakra's `ghost` variant resolves to `gray.800` in LIGHT mode while the
  modal hardcodes `bg="gray.800"`, so the ghost buttons were near-invisible (same for the "×"
  remove-period IconButton). The footers now carry ONLY the primary action — Save (edit) / Edit
  (view); closing uses the standard modal ✕ / ESC. The remove icon gets `color="whiteAlpha.800"`
  + a hover background.
- **Dates truncated to the year.** The `size="xl"` modal squeezed six columns. Now `size="4xl"`
  with explicit widths — `9.5rem` per ISO date, `7rem` fee/period, `10rem` split — plus nowrap
  headers; the split `Select` also gets an explicit white text colour.
- spec: design §"Dark surface + light-mode Chakra", tasks 11.2 (status tri-state bullet restored +
  this session's ergonomics).

Not changed (design question raised): `registration_fee` stays a PER-TYPE one-off (not per period).

Verified: editor 8 passed, `tsc --noEmit` clean, eslint clean.
fix(members): readable fee modals - drop ghost Cancel, widen dates (spec 50)
…50 R14)

Only the membership-type column was wired to the shared table framework; the money, period and
status columns were plain `<Th>` cells.

- `buildFeeRows` now derives the framework fields per row: `registrationText` / `currentFeeText`
  (currency-free decimals, so filtering "12" works), `registrationValue` / `currentFeeValue`
  (numbers — `useTableSort` only compares numbers numerically), `currentRange` / `currentStart`
  (range text + ISO start for chronological sort), and `statusKey` / `statusRank` (enum filter +
  semantic order: current -> planned-only -> not configured). Cells keep rendering formatted money.
- `MembershipFeesEditor`: `FilterableHeader` on all five columns (money + period as text filters,
  status as an enum `Select`), default sort = type asc; the status badge now reads `row.statusKey`.
- tests: model 18 -> 21 (framework fields incl. future-only), editor 8 -> 12 (five sortable headers +
  the three filter controls, money filter, numeric current-fee sort, status enum filter).
- spec: design "Every column is filterable + sortable", tasks 11.2/11.3.

Verified: vitest 40 passed (model 21, editor 12, translations 7), `tsc --noEmit` clean, eslint clean.
feat(members): every fee-table column is filterable + sortable (spec 50)
The `50 - memberships` folder had requirements/design/tasks/.config.kiro but no README, unlike the
area convention (each spec folder carries an index so the area README links resolve to something
readable).

- Status: complete (implementation) with the single open item called out — Task 10.3, the
  `test -> main` promotion merge.
- Summary of the delivered model (derived `membership_fee`, config#membership_fees catalog, the
  tenure rule, read-once path) + reading order.
- Key-decision table pointing at the authoritative spec section for each (catalog placement,
  periods shape, per-type registration, HALF_UP, whole-object write, contiguous append, tri-state).
- Out of scope, implementation map (backend/frontend/docs/tests paths, all verified to exist),
  the shipped PR chain (#280, #281-#285 with merge SHAs), the FTS state, the promotion runbook,
  and a change log.
docs(specs): add the Members 50 spec README (index + status + decisions)
@PeterGeers
PeterGeers merged commit 9e72596 into main Nov 30, 2026
11 checks passed
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.

1 participant