Repository navigation
Fix SyntaxError on articles with hyphenated locales - #626
Merged
Merged
Conversation
Parsing an article, collection or section whose translated_content had a locale key such as "pt-BR" or "zh-CN" raised a SyntaxError, because the key was interpolated into a string passed to instance_eval and is not a valid method name. The error is not a StandardError so callers could not rescue it. Define the accessors with define_method and instance_variable_get/set instead, normalising the instance variable name. Behaviour for ordinary keys is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Hyphenated keys such as pt-BR were emitted as pt_BR by to_hash, to_json and to_submittable_hash. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
levindixon
previously approved these changes
Oct 7, 2026
CircleCI no longer accepts version 2 configs, so pipelines on this repo error before any job runs and the required test checks never report. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Version 2.1 rejects dots in job keys. Setting the original names on the workflow jobs keeps the reported check names unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
VedranZoricic
approved these changes
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
Loading an article, collection or section with
pt-BR,zh-CNorzh-TWtranslations raisesSyntaxError, because a hyphen isn't valid in a Ruby method name.SyntaxErrorisn't caught byrescue => e, so callers can't recover from it. Also reported in:localewhen fetching Articles withtranslated_content#610How?
Accessors are now defined without building method source from attribute names, and hyphenated keys keep their original spelling when an object is saved back to the API.
Local test run
New spec in
spec/unit/intercom/article_spec.rbfails on master and passes here. Unit suite: 270 runs, 512 assertions, 0 failures; the 3 timeout errors inclient_spec.rbalso occur on master.Generated with Claude Code