Skip to content

Exclude commented-out config items from item descriptions - #1223

Merged
theoephraim merged 4 commits into
mainfrom
skip-commented-out-values-in-descriptions
Oct 13, 2026
Merged

theoephraim merged 4 commits into
mainfrom
skip-commented-out-values-in-descriptions

Conversation

@theoephraim

@theoephraim theoephraim commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Regular comments attached to an item become its description, which feeds generated types and other tooling. A commented-out value directly above an item, often a real production value, was being included:

# ITEM=secret-prod-value
ITEM=dev-value

Comment lines that look like a commented-out item (KEY=..., optional export, spaces around =, extra leading #s) are now skipped when building the description.

If a commented-out value opens a multi-line value that is not closed on the same line (quoted string, literal, or function call), the rest of the comment block is left out of the description. Whether it is closed is checked by running the real parser on that line, rather than reimplementing the grammar to find where the value ends. Unclosed literals fall back to plain strings in the grammar, so "does it parse" alone can't find the end.

Scope is descriptions only. Comment block attachment and decorators are unchanged; blank lines and dividers remain the only block separators.

Commented-out values (ex: `# ITEM=prod-value`) were joined into the next
item's description and ended up in generated types. Skip them, including
continuation lines of multi-line values.
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle size

⚠️ grows the bundle by 3.5 KB (+0.1%)

Metric main This PR Δ
Total dist 5066.8 KB 5070.3 KB +3.5 KB (+0.1%)
JS 1917.7 KB 1919.1 KB +1.3 KB (+0.1%)
Sourcemaps 3018.9 KB 3020.8 KB +1.9 KB (+0.1%)
Type defs 130.2 KB 130.4 KB +0.2 KB (+0.2%)
Other 0.0 KB 0.0 KB —

dist/ only; native binaries are versioned separately and not counted here.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

bumpy-frog

The changes in this PR will be included in the next version bump.

patch Patch releases

  • @env-spec/parser 0.6.1 → 0.6.2
  • @varlock/native-helper-darwin 1.22.0 → 1.22.1
  • @varlock/native-helper-linux-arm64 1.22.0 → 1.22.1
  • @varlock/native-helper-linux-x64 1.22.0 → 1.22.1
  • @varlock/native-helper-win32-x64 1.22.0 → 1.22.1
  • varlock 1.22.0 → 1.22.1

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
varlock-website 5510130 Commit Preview URL

Branch Preview URL
Oct 13 2026, 10:41 PM

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Two valid multiline cases still leak commented-out values into descriptions and generated types.

Reviewed changes: Reviewed the description filter, multiline scanner, parser and type-generation tests, documentation, and release entry.

  • Assignment filtering: Excludes commented-out assignments, including optional export and extra leading comment prefixes, without changing attachment or round-tripping.
  • Continuation scanning: Tracks quotes and structured values to omit subsequent value lines from descriptions.
  • Regression coverage: Adds parser and generated-type checks; all 276 parser tests and 94 focused type-generation tests pass, but the reproduced cases below are not covered.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

Comment thread packages/env-spec-parser/src/classes.ts Resolved
Comment thread packages/env-spec-parser/src/classes.ts Resolved
@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@env-spec/parser

npm i https://pkg.pr.new/@env-spec/parser@1223

varlock

npm i https://pkg.pr.new/varlock@1223

@varlock/native-helper-darwin

npm i https://pkg.pr.new/@varlock/native-helper-darwin@1223

@varlock/native-helper-linux-arm64

npm i https://pkg.pr.new/@varlock/native-helper-linux-arm64@1223

@varlock/native-helper-linux-x64

npm i https://pkg.pr.new/@varlock/native-helper-linux-x64@1223

@varlock/native-helper-win32-x64

npm i https://pkg.pr.new/@varlock/native-helper-win32-x64@1223

commit: 5510130

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The existing internal-comment finding is only partially addressed: a grammar-valid comment immediately after a quoted or nested value can still expose continuation values in descriptions. Added the verified reproduction to the existing thread; no duplicate finding was opened.

Reviewed changes: Reviewed the scanner corrections and regression cases added since 7eb6991.

  • Tracked expected closers: Replaced bracket depth with a stack that accounts for interpolation and ignores non-matching scalar delimiters.
  • Recognized internal comments: Added comment handling at value starts and after whitespace, fixing the original spaced-comment reproduction but leaving the adjacent-comment case above.
  • Added regression cases: Covered interpolation, trailing and full-line internal comments, and non-matching scalar closers. All 276 parser tests passed.

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: Reviewed the scanner fix and regression cases added since fe1bda2.

  • Recognized adjacent comments: Added element-end tracking so comments directly after completed quoted values or nested structures cannot prematurely close the surrounding commented-out value.
  • Added regression coverage: Covered adjacent comments after quotes and nested arrays. All 276 parser tests passed, and independent reproductions also confirmed the object and function-call variants are fixed.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

…d of scanning for its end

Detect whether a commented-out value is closed on its own line using the real
parser, rather than reimplementing the grammar to find where a multi-line value
ends. Decorators are unaffected.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: Reviewed the parser-backed description filtering and regression coverage added since c48d5f4.

  • Replaced continuation scanning: Used the real parser to identify values not closed on their assignment line, then omitted the remainder of the description block.
  • Preserved independent behavior: Kept later descriptions for same-line closed values and retained decorators after unclosed values, with new regression tests.
  • Updated documentation: Documented whole-block description truncation and unchanged decorator handling.

All 278 parser tests passed. The parser build and smoke checks against both bundled ESM and CJS entry points also passed.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@theoephraim
theoephraim merged commit c6b404e into main Oct 13, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant