You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hcl2tojson --with-meta flag accepted but produces no metadata #291
bugSomething isn't workingclihcl2tojson, jsontohcl2, and hq CLIsinternal-testingFound during internal test runsserializationLarkElement IR to Python dict (forward path)
The --with-meta flag is accepted without error but the output contains no __start_line__ / __end_line__ keys.
Root Cause
The with_meta option is a stub that was never wired up during the v8 architecture overhaul:
cli/hcl_to_json.py defines the flag and passes it to SerializationOptions ✓
hcl2/utils.py defines with_meta: bool = False on the dataclass ✓
No serialize() method in rules/base.py ever checks options.with_meta ✗
The metadata (line, end_line, column, end_column) exists on every LarkRule._meta — it's just never written to the output dict
hcl2/const.py is missing START_LINE_KEY / END_LINE_KEY constants
Tests only verify the flag is accepted without error, not that output contains metadata
Expected Behavior
When --with-meta is passed, every attribute and block in the output dict should include __start_line__ and __end_line__ keys sourced from LarkRule._meta.
Workaround
Use hq --with-location which correctly provides line/column metadata.
Suggested Fix
Each serialize() method (AttributeRule, BlockRule, etc.) needs to check if options.with_meta: and inject __start_line__ / __end_line__ keys from self._meta. Add corresponding constants to hcl2/const.py.
bugSomething isn't workingclihcl2tojson, jsontohcl2, and hq CLIsinternal-testingFound during internal test runsserializationLarkElement IR to Python dict (forward path)
Activity
test: pin the spans against v7 and the shapes that break line counting (