Skip to content

fix: detect and prevent Helm float64 mangling of Discord channel IDs (closes #43)#64

Merged
thepagent merged 1 commit intomainfrom
fix/issue-43-helm-channel-id-validation
Apr 6, 2026
Merged

fix: detect and prevent Helm float64 mangling of Discord channel IDs (closes #43)#64
thepagent merged 1 commit intomainfrom
fix/issue-43-helm-channel-id-validation

Conversation

@thepagent
Copy link
Copy Markdown
Collaborator

@thepagent thepagent commented Apr 6, 2026

Problem

Discord Snowflake IDs are 19-digit integers (> 2^53). Helm --set parses them as float64, losing precision and rendering them in scientific notation (e.g. 1.2345678901234568e+18). This causes agent-broker to silently ignore all messages.

Changes

1. templates/configmap.yaml — fail-fast validation

{{- if regexMatch "e\\+|E\\+" (toString .) }}
{{- fail "discord.allowedChannels contains a mangled ID — use --set-string" }}
{{- end }}

If a channel ID contains scientific notation, helm install/upgrade fails immediately with a clear error message instead of silently deploying a broken config.

2. templates/NOTES.txt — post-install warning

Shows --set-string usage reminder on every install/upgrade.

3. values.yaml — inline comment

Documents the --set-string requirement next to allowedChannels.

Before vs After

╔══════════════════════════════════════════════════════════════════════╗
║                      BEFORE (silent failure) 💀                      ║
╠══════════════════════════════════════════════════════════════════════╣
║                                                                      ║
║  User runs:                                                          ║
║  helm install ... --set discord.allowedChannels[0]=1234567890123456789
║                                                                      ║
║  ┌─────────────┐     ┌──────────────┐     ┌──────────────────┐       ║
║  │ Helm --set  │────▶│ float64 cast │────▶│ configmap.yaml   │       ║
║  │             │     │ precision 💥 │     │                  │       ║
║  └─────────────┘     └──────────────┘     │ allowed_channels │       ║
║                                           │ = ["1.23456789e+18"]     ║
║  1234567890123456789                      └────────┬─────────┘       ║
║  → 1.2345678901234568e+18                          │                 ║
║  → NEVER matches real ID                           ▼                 ║
║                                           ┌──────────────────┐       ║
║                                           │ agent-broker     │       ║
║                                           │ ignores ALL msgs │       ║
║                                           │ 🤷 no error log  │       ║
║                                           └──────────────────┘       ║
╠══════════════════════════════════════════════════════════════════════╣
║                      AFTER (fail fast) 🛡️                            ║
╠══════════════════════════════════════════════════════════════════════╣
║                                                                      ║
║  ❌ helm install ... --set discord.allowedChannels[0]=123...789       ║
║                                                                      ║
║  ┌─────────────┐     ┌──────────────┐     ┌──────────────────┐       ║
║  │ Helm --set  │────▶│ float64 cast │────▶│ configmap.yaml   │       ║
║  │             │     │ precision 💥 │     │ regexMatch "e+"  │       ║
║  └─────────────┘     └──────────────┘     │ ⛔ FAIL:         │       ║
║                                           │ "mangled ID,     │       ║
║                                           │  use --set-string"│      ║
║                                           └──────────────────┘       ║
║                                                                      ║
║  ✅ helm install ... --set-string discord.allowedChannels[0]="123..."
║                                                                      ║
║  ┌─────────────┐     ┌──────────────┐     ┌──────────────────┐       ║
║  │ --set-string│────▶│ kept as      │────▶│ configmap.yaml   │       ║
║  │             │     │ string ✅    │     │                  │       ║
║  └─────────────┘     └──────────────┘     │ allowed_channels │       ║
║                                           │ = ["123456789.."]│       ║
║                                           └────────┬─────────┘       ║
║                                                    ▼                 ║
║                                           ┌──────────────────┐       ║
║                                           │ agent-broker     │       ║
║                                           │ matches! ✅      │       ║
║                                           │ 🎉 msgs received │       ║
║                                           └──────────────────┘       ║
╚══════════════════════════════════════════════════════════════════════╝

Testing

# This will now FAIL with a helpful error:
helm template test . --set discord.allowedChannels[0]=1234567890123456789

# This works correctly:
helm template test . --set-string discord.allowedChannels[0]="1234567890123456789"

Closes #43

- Add regexMatch validation in configmap template to fail early if
  channel IDs contain scientific notation (e+/E+)
- Add --set-string warning in NOTES.txt
- Add --set-string comment in values.yaml

Closes #43
@thepagent thepagent merged commit 899c3d7 into main Apr 6, 2026
thepagent added a commit that referenced this pull request Apr 6, 2026
Includes:
- #62 structured sender identity injection
- #64 Helm float64 channel ID validation
thepagent added a commit that referenced this pull request Apr 6, 2026
Includes #62 (sender identity injection) and #64 (Helm float64 validation).
Reese-max pushed a commit to Reese-max/openab that referenced this pull request Apr 12, 2026
…penabdev#64)

Add fail-fast validation in configmap template to detect scientific notation in channel IDs, plus --set-string warnings in NOTES.txt and values.yaml.

Closes openabdev#43
Reese-max pushed a commit to Reese-max/openab that referenced this pull request Apr 12, 2026
Includes openabdev#62 (sender identity injection) and openabdev#64 (Helm float64 validation).
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.

bug: Helm --set mangles Discord channel IDs (float64 precision loss)

2 participants