[h1-request] 同期v2: 締め日(月次・年次)と締め例外の配布、h1由来伝票のunlock禁止 #57
Labels
No labels
h1-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
joe/o2#57
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
締めたら全区分をロックする。年次決算は例外なし、月次締めは例外を設けられる。発行ロックの解除は廃止(訂正は赤黒のみ)。
依頼内容(ADR-0002 §9・§5)
closed_through(月次・年次のうち連続して締まった最新期間の末日)とannual_closed_through(年次決算の同値)をAccountingPeriodから算出fiscal_closeを配布(h1 は前進のみ受け入れ)LockException(tenant, period_start, period_end, aggregate_type?, document_type?, aggregate_id?, until, reason, granted_by, revoked_at?)の管理画面と API、付与・更新・取消のたびにlock_exceptionを配布annual_closed_through < doc_date <= closed_throughのみ。条件は指定したもの全てに一致。条件なしは「その月の全変更」。until経過で失効rejected_fiscal判定に上記を適用/api/documents/{id}/unlockを h1 由来伝票に対して禁止受け入れ条件
契約の正本: ADR-0002(ブランチ
docs/adr-0002-offline-first-sync-v2。未マージなら先に main へマージしてから着手)https://git.cyberius.biz/joe/o2/src/branch/docs/adr-0002-offline-first-sync-v2/docs/adr/0002-offline-first-sync-v2.md
h1 側の内部設計(参考): https://git.cyberius.biz/joe/h1-c2/src/branch/main/docs/superpowers/specs/2026-10-09-offline-first-sync-design.md
前提: h1 は本体単体で完全稼働し、o2 接続時のみ同期する。v1(
/api/sync/push|pull・/api/sync/corrections*)は h1 の移行完了まで並行稼働を維持すること(v1 を壊さない)。検証データ: 入出力例を
tests/fixtures/sync_v2/*.jsonに追加する。h1 は同じ fixture を Dart テストで検証する(sales_calculationfixture と同じ運用)。実装完了(o2側)— 締め日と例外の配布・h1由来 unlock 禁止
実装
closed_through(連続して締まっている最新期間の末日)/annual_closed_through(連続する年次決算の末日)を算出LockException(period_start/period_end、aggregate_type/document_type/aggregate_id、until、revoked_at)annual_closed_through < doc_date <= closed_throughのみ。年次決算済みには例外無効。条件は指定分すべて一致、無指定は全変更許可、until経過で自動失効fiscal_close/lock_exceptionを配信、push のrejected_fiscalに反映DocumentServiceガード+API 409)。発行ロック解除は不受理(訂正は赤黒)GET /api/sync/v2/fiscal、POST .../fiscal/close|reopen、GET/POST/PUT/DELETE /api/sync/v2/lock-exceptions/sync-fiscal(締め設定・例外管理)b9c1d2e3f4a5、fixtures(fiscal_close / lock_exception)インフラ注意: 現在リモートへの git push が SSH タイムアウト(
www.cyberius.biz:18)で失敗中。実装はローカル main にマージ済み・o2.db適用済みで、push は回復後に実施します。回帰確認: 全 6422 passed, 1 skipped。