-
Notifications
You must be signed in to change notification settings - Fork 54
Normalize entity names to capitalized form throughout config #1479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -995,10 +995,14 @@ let fromPublic = (publicConfigJson: JSON.t) => { | |
|
|
||
| let allEntities = userEntities->Array.concat([EnvioAddresses.entityConfig]) | ||
|
|
||
| // Keyed by the capitalized entity name to match the handler-context | ||
| // accessor (`context.Pool_snapshots`) the generated types expose, while | ||
| // entityConfig.name stays the original schema name used for the physical | ||
| // Postgres/ClickHouse tables. | ||
| let userEntitiesByName = | ||
| userEntities | ||
| ->Array.map(entityConfig => { | ||
| (entityConfig.name, entityConfig) | ||
| (entityConfig.name->Utils.String.capitalize, entityConfig) | ||
| }) | ||
| ->Dict.fromArray | ||
|
Comment on lines
+998
to
1007
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "fromArray|capitalize|userEntitiesByName" \
packages/envio/src/Config.res \
packages/envio/src/TestIndexer.res \
packages/envio/src/Utils.resRepository: enviodev/hyperindex Length of output: 2910 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '930,1060p' packages/envio/src/Config.res
printf '\n---\n'
sed -n '180,220p' packages/envio/src/TestIndexer.res
printf '\n---\n'
sed -n '690,720p' packages/envio/src/TestIndexer.res
printf '\n---\n'
sed -n '415,440p' packages/envio/src/Utils.res
printf '\n---\n'
sed -n '615,640p' packages/envio/src/Utils.resRepository: enviodev/hyperindex Length of output: 9025 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "duplicate|collision|unique|entity.*name|name.*duplicate|capitalize" packages/envio/src/Config.res packages/envio/src -g '!**/node_modules/**'Repository: enviodev/hyperindex Length of output: 11730 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,220p' packages/envio/src/Utils.res | sed -n '120,220p'
printf '\n---\n'
sed -n '560,700p' packages/envio/src/Utils.resRepository: enviodev/hyperindex Length of output: 7761 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "entityConfig|userEntities|entities" packages/envio/src/Config.res -nRepository: enviodev/hyperindex Length of output: 1386 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "entity.*(set|unique|duplicate|collision)|Dict\\.fromArray|fromArrayUnsafe|capitalize" packages/envio/src/Config.res packages/envio/src -g '!**/node_modules/**'Repository: enviodev/hyperindex Length of output: 5713 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "^[^/].*name.*regex|regex.*name|lowercase|snake_case|entity name|contract name|validate.*name|allowed.*name" packages/envio/src/Config.res packages/envio/src -g '!**/node_modules/**'Repository: enviodev/hyperindex Length of output: 5368 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '400,560p' packages/envio/src/Config.res
printf '\n---\n'
sed -n '560,700p' packages/envio/src/Config.res
printf '\n---\n'
rg -n "entityJsonSchema|name:|parseEntitiesFromJson|capitalize" packages/envio/src/Config.res packages/envio/src -g '!**/node_modules/**'Repository: enviodev/hyperindex Length of output: 17702 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '400,560p' packages/envio/src/Config.res
printf '\n---\n'
sed -n '560,700p' packages/envio/src/Config.res
printf '\n---\n'
rg -n "entityJsonSchema|parseEntitiesFromJson|capitalize|name:" packages/envio/src/Config.res packages/envio/src -g '!**/node_modules/**'Repository: enviodev/hyperindex Length of output: 17702 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '320,420p' packages/envio/src/Config.res
printf '\n---\n'
python3 - <<'PY'
def capitalize(s):
return s[:1].upper() + s[1:]
samples = ["foo", "Foo", "fOo", "bar", "Bar", "pool_snapshots", "Pool_snapshots"]
mapped = {}
for s in samples:
k = capitalize(s)
mapped.setdefault(k, []).append(s)
print(mapped)
PYRepository: enviodev/hyperindex Length of output: 3780 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n "^module Dict|fromArray" packages/envio/src/Utils.res
printf '\n---\n'
sed -n '500,650p' packages/envio/src/Utils.resRepository: enviodev/hyperindex Length of output: 5467 Reject capitalized entity-name collisions in config parsing. 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the issue-link-only comment.
This comment records issue history but does not explain behavior the code cannot show. Remove it or replace it with a concise invariant explaining why lowercase entity names are covered.
🤖 Prompt for AI Agents
Source: Coding guidelines