Skip to content

Drop maximum_name_length from permissions; move to Constants#49

Merged
dadachi merged 1 commit intosubstrate-v2from
substrate-v2--drop-maximum-name-length-from-permissions
Apr 27, 2026
Merged

Drop maximum_name_length from permissions; move to Constants#49
dadachi merged 1 commit intosubstrate-v2from
substrate-v2--drop-maximum-name-length-from-permissions

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented Apr 27, 2026

Summary

Ports nativeapptemplate/NativeAppTemplate-iOS#59. Two-step cleanup of `maximumNameLength` now that the server no longer sends `maximum_name_length` in the `/shopkeeper/permissions` meta.

Changes

Step 1 — Stop reading `maximum_name_length` from /shopkeeper/permissions. The client already tolerated its absence via a `?? 100` fallback, so this is dead plumbing. Drops the field from `PermissionsResponse`, the meta read in `PermissionsRequest.handle`, and the assignment in `SessionController.fetchPermissions`.

Step 2 — Move `maximumNameLength` from `SessionController` to `Constants`. Now that it's a fixed value, it's just a constant — like `maximumItemTagDescriptionLength`. Adds `NativeAppTemplateConstants.maximumItemTagNameLength = 100`, drops `maximumNameLength` from `SessionControllerProtocol` / `SessionController` / `NullSessionController` / `TestSessionController`. `ItemTagCreateViewModel` and `ItemTagEditViewModel` now read the constant directly and no longer take `sessionController` (it had no other use in those view models). Updates the two call sites in `ItemTagListView` / `ItemTagDetailView`. Tests rewritten: drop `sessionController` field, remove all `sessionController.maximumNameLength = N` overrides, and update the two truncation tests to use 100+ char strings against the constant.

Test plan

  • `xcodebuild build-for-testing` — `** TEST BUILD SUCCEEDED **`
  • `make lint` — `0 violations` (SwiftLint + SwiftFormat)
  • `xcodebuild test` passes (please verify in Xcode with Cmd+U). Updated `ItemTagCreateViewModelTest` and `ItemTagEditViewModelTest` should pass — particularly `maximumNameLength`, `nameValidation`, and `validateNameLengthTruncatesCorrectly`.
  • Manual: create / edit an ItemTag — name field should still cap at 100 characters; help text should still display "max 100".

🤖 Generated with Claude Code

Ports nativeapptemplate/NativeAppTemplate-iOS#59.

Two-step cleanup of maximumNameLength:

1. Stop reading maximum_name_length from /shopkeeper/permissions. The
   client already tolerated its absence via a "?? 100" fallback, so this
   is dead plumbing. Drops the field from PermissionsResponse, the meta
   read in PermissionsRequest.handle, and the assignment in
   SessionController.fetchPermissions.

2. Move maximumNameLength from SessionController to Constants. Now that
   it's a fixed value, it's just a constant — like
   maximumItemTagDescriptionLength. Adds
   NativeAppTemplateConstants.maximumItemTagNameLength = 100, drops
   maximumNameLength from SessionControllerProtocol / SessionController /
   NullSessionController / TestSessionController. ItemTagCreateViewModel
   and ItemTagEditViewModel now read the constant directly and no longer
   take sessionController. Updates the call sites in ItemTagListView /
   ItemTagDetailView. Tests rewritten to drop sessionController field
   and update truncation tests to use 100+ char strings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 8d7d2f6 into substrate-v2 Apr 27, 2026
2 checks passed
@dadachi dadachi deleted the substrate-v2--drop-maximum-name-length-from-permissions branch April 27, 2026 08:39
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