Skip to content

Enforce Lite-mode scoping server-side; rename IsChild→IsLite (schema kept) - #40

Merged
alvachien merged 1 commit into
mainfrom
chroe/keepimprv-6
Oct 5, 2026
Merged

alvachien merged 1 commit into
mainfrom
chroe/keepimprv-6

Conversation

@alvachien

Copy link
Copy Markdown
Owner

Summary

Two coupled batches, one commit (f3e9bf7):

1. Lite-mode (restricted home member) server-side scoping

  • FinancePlans reads/writes, FinanceDocumentItemViews (insight/search pipeline), GetFinanceOverviewKeyFigure and GetAccountBalance(Ex) now scope to the member's own accounts/control centers; foreign targets get 401 (GetAccountBalance also gained an account↔home binding it previously lacked).
  • Overview outgo figures normalized to positive magnitudes; document-item view DDL ROUND(… , 2) applied before the expense sign flip (DatabaseSeeder view + FinanceDocument model).
  • Coverage: FinanceLiteScopeTest (unit) + FinanceLiteScopeODataTest (integration over real HTTP).

2. IsChild → IsLite rename — code + wire, schema untouched

  • EF property renamed and pinned to the historical column: [Column("ISCHILD")] — no schema change, no SchemaUpgrade step; dev server boots cleanly against the existing hih.db.
  • EdmModelBuilder is model-bound, so the OData/JSON property becomes IsLite automatically for serialization and PUT/POST binding (13 controllers' LINQ filters/guards renamed, dead UserInfo model included).
  • New integration assertion pins the wire contract: HomeMembers payload contains "IsLite", never "IsChild".

Compatibility note ⚠

Pairs with achihui PR #365 (UI wire flipped to IsLite). Deploy the two together: an old UI PUTing IsChild against this API is rejected by strict OData binding (loud); a new UI against the old API would silently treat all members as non-Lite.

Test plan

  • dotnet build achihapi.sln — 0 errors
  • dotnet test — 412 unit + 6 integration pass (incl. new wire-format assertions)
  • POST /health Healthy after restart against real DB

🤖 Generated with Claude Code

…ma kept)

Lite-mode (restricted) home members are enforced beyond the UI:
- FinancePlans reads/writes, FinanceDocumentItemViews (insight/search),
  GetFinanceOverviewKeyFigure and GetAccountBalance(Ex) are scoped to the
  member's own accounts/control centers; foreign targets get 401.
- Overview outgo figures normalized to positive magnitudes; document-item
  view rounds expense amounts to 2 decimals before sign flip.
- Version bumped to 1.8.400.

Terminology: HomeMember.IsChild -> IsLite across the EF model, the
EDM/OData wire property, controllers and tests. The SQLite column keeps
its historical name ISCHILD via explicit [Column] mapping - no schema
change, no upgrade step. Integration tests pin the new wire name
(payload contains IsLite, never IsChild).

Tests: 412 unit + 6 integration pass (dotnet test achihapi.sln).

Co-Authored-By: Claude Code <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Health
hihapi.test.common 94% 68% ✔
hihapi 66% 51% ➖
Summary 72% (7926 / 10970) 52% (1583 / 3067) ➖

Minimum allowed line rate is 50%

@alvachien
alvachien merged commit 94a0dea into main Oct 5, 2026
2 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