Skip to content

Commit 6288521

Browse files
dadachiclaude
andauthored
Drop articles before domain nouns for rename safety (#56)
Apply the substrate rename-safety contract: remove "a" / "an" / "the" directly preceding Shop, Shopkeeper, and ItemTag (in any case form) across test descriptors, code comments, OpenAPI summaries, and substrate meta-docs. The agent's text-only rename pipeline would otherwise produce article disagreements like "an patient" or "a office" when users pick consonant- or vowel-starting rename targets. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent fbcc22c commit 6288521

8 files changed

Lines changed: 28 additions & 28 deletions

docs/nativeapptemplate-substrate-v2-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ See section 6.10 for rationale on the unified permission approach.
140140

141141
**Endpoints unchanged but with behavior change**:
142142
- `POST /api/v1/shopkeeper/shops/:shop_id/item_tags` — no longer auto-generates A001-A010; creates a single item with user-supplied `name`
143-
- `POST /api/v1/shopkeeper/shops` — creating a Shop now auto-generates exactly 1 "Sample" ItemTag (instead of 10 queue-number items), so new users see a reference item on the Shop detail screen instead of an empty state
143+
- `POST /api/v1/shopkeeper/shops` — creating Shop now auto-generates exactly 1 "Sample" ItemTag (instead of 10 queue-number items), so new users see a reference item on Shop detail screen instead of an empty state
144144

145145
### 2.3 UI contract
146146

@@ -489,7 +489,7 @@ The Rails API uses a custom fixture system in `db/fixtures/<env>/` (not standard
489489

490490
### 8.3 What to avoid
491491

492-
- Do NOT resurrect the Day 1 approach of fully deleting `ItemTag`. The Shop detail screen becomes empty without a child resource, and the agent's planner prompt assumes `ItemTag` exists as a rename target.
492+
- Do NOT resurrect the Day 1 approach of fully deleting `ItemTag`. Shop detail screen becomes empty without a child resource, and the agent's planner prompt assumes `ItemTag` exists as a rename target.
493493
- Do NOT introduce a new child model name (e.g. `ShopItem`). Keeping `ItemTag` aligns with the agent's planner prompt.
494494
- Do NOT add i18n / Localizable.strings indirection in Phase 2-5. UI strings should be direct literals so the agent's string-literal rename (Phase 6) can operate on them.
495495
- Do NOT touch the `AccountsInvitation` model or multi-account join table. Those stay; Free client just hides their UI.

docs/openapi.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ paths:
799799
/shopkeeper_auth/sign_in:
800800
post:
801801
operationId: signIn
802-
summary: Sign in a shopkeeper
802+
summary: Sign in shopkeeper
803803
tags: [Auth - Sessions]
804804
security: []
805805
servers:
@@ -857,7 +857,7 @@ paths:
857857
/shopkeeper_auth/sign_out:
858858
delete:
859859
operationId: signOut
860-
summary: Sign out a shopkeeper
860+
summary: Sign out shopkeeper
861861
tags: [Auth - Sessions]
862862
servers:
863863
- url: /
@@ -1148,7 +1148,7 @@ paths:
11481148

11491149
get:
11501150
operationId: getShop
1151-
summary: Get a shop
1151+
summary: Get shop
11521152
tags: [Shops]
11531153
responses:
11541154
'200':
@@ -1165,7 +1165,7 @@ paths:
11651165

11661166
patch:
11671167
operationId: updateShop
1168-
summary: Update a shop
1168+
summary: Update shop
11691169
tags: [Shops]
11701170
requestBody:
11711171
required: true
@@ -1190,7 +1190,7 @@ paths:
11901190

11911191
delete:
11921192
operationId: deleteShop
1193-
summary: Delete a shop
1193+
summary: Delete shop
11941194
tags: [Shops]
11951195
responses:
11961196
'200':
@@ -1214,7 +1214,7 @@ paths:
12141214

12151215
get:
12161216
operationId: listItemTags
1217-
summary: List item tags for a shop
1217+
summary: List item tags for shop
12181218
tags: [Item Tags]
12191219
parameters:
12201220
- name: page
@@ -1256,7 +1256,7 @@ paths:
12561256

12571257
post:
12581258
operationId: createItemTag
1259-
summary: Create an item tag in a shop
1259+
summary: Create item tag in shop
12601260
tags: [Item Tags]
12611261
requestBody:
12621262
required: true
@@ -1290,7 +1290,7 @@ paths:
12901290

12911291
get:
12921292
operationId: getItemTag
1293-
summary: Get an item tag
1293+
summary: Get item tag
12941294
tags: [Item Tags]
12951295
responses:
12961296
'200':
@@ -1309,7 +1309,7 @@ paths:
13091309

13101310
patch:
13111311
operationId: updateItemTag
1312-
summary: Update an item tag
1312+
summary: Update item tag
13131313
tags: [Item Tags]
13141314
requestBody:
13151315
required: true
@@ -1336,7 +1336,7 @@ paths:
13361336

13371337
delete:
13381338
operationId: deleteItemTag
1339-
summary: Delete an item tag
1339+
summary: Delete item tag
13401340
tags: [Item Tags]
13411341
responses:
13421342
'200':
@@ -1361,7 +1361,7 @@ paths:
13611361

13621362
patch:
13631363
operationId: completeItemTag
1364-
summary: Mark an item tag as completed
1364+
summary: Mark item tag as completed
13651365
tags: [Item Tags]
13661366
responses:
13671367
'200':
@@ -1393,7 +1393,7 @@ paths:
13931393

13941394
patch:
13951395
operationId: idleItemTag
1396-
summary: Reset an item tag to idled state
1396+
summary: Reset item tag to idled state
13971397
tags: [Item Tags]
13981398
responses:
13991399
'200':

docs/phase1-rails-api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ class Shop < ApplicationRecord
378378
end
379379
```
380380

381-
**Rationale for sample item**: When a Shop is first created, the Shop detail screen would otherwise be empty. A single generic "Sample" item gives users a reference to understand the UI and something to delete/edit to learn the flow. The client-side empty state UI (already implemented) handles the case after the sample is deleted.
381+
**Rationale for sample item**: When Shop is first created, Shop detail screen would otherwise be empty. A single generic "Sample" item gives users a reference to understand the UI and something to delete/edit to learn the flow. The client-side empty state UI (already implemented) handles the case after the sample is deleted.
382382

383383
Check callers of removed methods:
384384

@@ -406,7 +406,7 @@ git commit -m "Simplify Shop model: replace queue auto-generation with single sa
406406
- Filter on `queue_number`, `scan_state`, etc.
407407

408408
**Ensure standard CRUD actions work**:
409-
- `index` — list item_tags for a shop
409+
- `index` — list item_tags for shop
410410
- `show` — single item_tag
411411
- `create` — requires `name`, accepts optional `description`, `position`
412412
- `update` — modify `name`, `description`, `position`, `state`
@@ -757,7 +757,7 @@ end
757757
- Update fixture data references (`queue_number``name`)
758758
- Remove tests for removed endpoints (scan, reset_all)
759759
- Add tests for `description`, `position` handling
760-
- Note: tests that create a Shop will now also create a sample ItemTag via the callback. Adjust `assert_difference` expectations: creating a Shop now creates 1 Shop + 1 ItemTag.
760+
- Note: tests that create Shop will now also create a sample ItemTag via the callback. Adjust `assert_difference` expectations: creating Shop now creates 1 Shop + 1 ItemTag.
761761

762762
**`test/policies/api/shopkeeper/item_tag_policy_test.rb`**:
763763
- Remove tests for deleted permission tags
@@ -912,7 +912,7 @@ Expected: all green, 0 failures, 0 errors. Test count will be lower than baselin
912912
bin/rails server -d
913913

914914
# Create a test shopkeeper and shop, then verify:
915-
# - Creating a shop creates exactly 1 "Sample" item_tag automatically
915+
# - Creating shop creates exactly 1 "Sample" item_tag automatically
916916
# - The sample item_tag has state: "idled"
917917
# - Manual CRUD on item_tags works
918918

@@ -1002,7 +1002,7 @@ Early, to catch fixture association breakage.
10021002

10031003
### 6. Sample item_tag and test isolation
10041004

1005-
After the refactor, creating a Shop in tests auto-creates 1 ItemTag via `create_sample_item_tag`. Tests that count ItemTags must account for this:
1005+
After the refactor, creating Shop in tests auto-creates 1 ItemTag via `create_sample_item_tag`. Tests that count ItemTags must account for this:
10061006

10071007
```ruby
10081008
# Before: 0 item_tags after shop creation

test/controllers/api/v1/shopkeeper/base_controller_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def setup
99
end
1010

1111
test "render_validation_error returns 422 with error messages" do
12-
# Try to create an item_tag with a blank name to trigger validation error
12+
# Try to create item_tag with a blank name to trigger validation error
1313
post api_v1_shopkeeper_shop_item_tags_url(@shop),
1414
params: {item_tag: {name: ""}},
1515
headers: @shopkeeper.create_new_auth_token

test/controllers/api/v1/shopkeeper/item_tags_controller_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Api::V1::Shopkeeper::ItemTagsControllerTest < ActionDispatch::IntegrationT
6161
end
6262

6363
# show
64-
test "show returns an item_tag detail" do
64+
test "show returns item_tag detail" do
6565
get api_v1_shopkeeper_item_tag_url(@item_tag), headers: @shopkeeper.create_new_auth_token
6666
assert_response :success
6767
assert_equal response.parsed_body["data"]["attributes"]["name"], @item_tag.name
@@ -131,7 +131,7 @@ class Api::V1::Shopkeeper::ItemTagsControllerTest < ActionDispatch::IntegrationT
131131
end
132132

133133
# destroy
134-
test "destroy deletes an item_tag" do
134+
test "destroy deletes item_tag" do
135135
assert_difference "ItemTag.count", -1 do
136136
delete api_v1_shopkeeper_item_tag_url(@item_tag),
137137
headers: @shopkeeper.create_new_auth_token
@@ -149,7 +149,7 @@ class Api::V1::Shopkeeper::ItemTagsControllerTest < ActionDispatch::IntegrationT
149149
end
150150

151151
# complete
152-
test "complete completes an item_tag" do
152+
test "complete completes item_tag" do
153153
patch complete_api_v1_shopkeeper_item_tag_url(@item_tag), headers: @shopkeeper.create_new_auth_token
154154
assert_response :success
155155
assert @item_tag.reload.completed?
@@ -165,7 +165,7 @@ class Api::V1::Shopkeeper::ItemTagsControllerTest < ActionDispatch::IntegrationT
165165
end
166166

167167
# idle
168-
test "idle resets an item_tag" do
168+
test "idle resets item_tag" do
169169
@item_tag.complete!
170170
assert @item_tag.reload.completed?
171171

test/controllers/api/v1/shopkeeper/shops_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Api::V1::Shopkeeper::ShopsControllerTest < ActionDispatch::IntegrationTest
2121
end
2222

2323
# show
24-
test "show returns a shop detail" do
24+
test "show returns shop detail" do
2525
get api_v1_shopkeeper_shop_url(@shop), headers: @shopkeeper.create_new_auth_token
2626
assert_response :success
2727
assert_equal response.parsed_body["data"]["attributes"]["name"], @shop.name
@@ -72,7 +72,7 @@ class Api::V1::Shopkeeper::ShopsControllerTest < ActionDispatch::IntegrationTest
7272
end
7373

7474
# destroy
75-
test "destroy deletes a shop" do
75+
test "destroy deletes shop" do
7676
assert_difference "Shop.count", -1 do
7777
delete api_v1_shopkeeper_shop_url(@shop),
7878
headers: @shopkeeper.create_new_auth_token

test/models/accounts_invitation_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def setup
167167
member: true
168168
)
169169

170-
# Create a shopkeeper that's already a member
170+
# Create shopkeeper that's already a member
171171
other_shopkeeper = shopkeepers(:two)
172172
AccountsShopkeeper.create!(
173173
account: @account,

test/models/shop_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setup
2828
assert_equal @shopkeeper, shop.created_by
2929
end
3030

31-
test "creating a shop creates exactly one sample item tag" do
31+
test "creating shop creates exactly one sample item tag" do
3232
ActsAsTenant.with_tenant(@account) do
3333
shop = @account.shops.create!(name: "Test Shop", created_by: @shopkeeper)
3434
assert_equal 1, shop.item_tags.count

0 commit comments

Comments
 (0)