Files
ECC/tests
Souptik Chakrabortyandhaelyra f1521c8937 test(gateguard): read env knobs from code and pin the access convention
The documentation surface test scanned the hook's raw source with two
regexes. That had two holes, both confirmed against the shipped parser:

- a GATEGUARD_* name appearing only in a comment or a string was counted
  as a real read, and
- destructured, aliased and computed reads were invisible, so an
  undocumented knob added in one of those forms would pass silently.

Blank comments, string literals, template-literal text and regex literals
before scanning, so only real code contributes. Blanking preserves length,
so `process.env[...]` keys are located in the blanked code and read back
from the raw source at the same offset.

Rather than chase every possible access form with regexes, the supported
forms are now enforced: destructuring, aliasing, spreading, enumerating
and computed keys fail the guard with instructions to either keep the
convention or extend the parser. Six self-checks cover the blanker and
the guard, including a regex literal containing a slash.

Refs #2573
2026-08-29 14:55:13 -04:00
..
2026-04-12 12:34:45 +05:30