Repository navigation
feat(rules): add Dhall review rules - #963
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). |
4bead34 to
e685498
Compare
|
@lizhengfeng101 Please review and merge this. Future main updates might cause more conflicts. Thanks :) |
e685498 to
611b2cd
Compare
848246c to
4579f84
Compare
`.dhall` was missing from the extension allowlist, so Dhall files were filtered out before rule resolution ever ran and no review rule could apply to them. This adds `.dhall` to the allowlist, adds a `**/*.dhall` -> `dhall.md` entry to `path_rule_map`, and lists the mapping in the review-rules docs table for all four locales. The rule doc leans on what Dhall's type checker cannot already catch: unpinned remote imports missing a `sha256:` hash, stale hashes after an import target moves, `env:` secrets leaking into rendered artifacts, and self-referential `let` bindings (the language is total, so recursion is a design error rather than a style nit). It explicitly does not flag bare relative imports or the Prelude's `missing sha256:... ? ./local` cache idiom, both of which look like unpinned imports but are not.
4579f84 to
32e4c89
Compare
|
@lizhengfeng101 Rebased onto main and conflicts resolved. Please review and merge this. Thanks :) |
Main's Objective-C/MATLAB `.m` rule appended to the same rule-resolution table and the same pattern table in all four locales of review-rules.md that this branch appends the Dhall rows to. Kept both, main's first. Claude-Session: https://claude.ai/code/session_01FoMHZQ3qqdt98LHTwSJuTG
|
@lizhengfeng101 Rebased onto main and conflicts resolved again. Please review this. Thanks :) |
|
Thanks for the contribution! Clean data-only change following the established patterns. Dhall has a fairly small user base, so I'd like to wait for someone with hands-on Dhall experience to review the rule doc before merging. I want to make sure the checks reflect real-world Dhall pitfalls rather than theoretical ones. Leaving this open — happy to merge once a domain expert signs off. |
…port Signed-off-by: ChethanUK <[email protected]> # Conflicts: # internal/config/allowlist/allowed_ext_test.go # internal/config/allowlist/supported_file_types.json # internal/config/rules/system_rules_test.go # pages/src/content/docs/en/review-rules.md # pages/src/content/docs/ja/review-rules.md # pages/src/content/docs/ru/review-rules.md # pages/src/content/docs/zh/review-rules.md
Rule docs resolve per file, so the generated YAML/JSON section in dhall.md could never apply. The self-referencing let, non-exhaustive merge and completion typo cases are already type errors, and the fold-bound and Optional-default rules needed intent a reviewer cannot see. Reading a credential from env: is the right pattern, so only a real-looking secret fallback is flagged now. The stale-hash rule now says what happens: a warm cache keeps serving the old content by hash and a cold cache fails. Adds two real pitfalls: env: without `as Text` for a Text value, and `//` used for a nested update where `with` was meant. Also adds the Dhall row to the Korean rule table that came in from main. Signed-off-by: ChethanUK <[email protected]>
|
@chethanuk merge conflicts |
Resolve conflicts with the GLSL/HLSL/WGSL/Metal, EJS/Liquid/Nunjucks, Clojure/EDN, CUDA/HIP, PowerShell and Move additions: keep both sides in the allowlist and test tables, and slot the `**/*.dhall` row after `**/*.bicep` in the review-rules tables to match system_rules.json. Signed-off-by: ChethanUK <[email protected]>
|
@lizhengfeng101 Merged |
Description
.dhallfiles were never reviewed. The extension is missing fromsupported_file_types.json, soIsAllowedExtdrops them at the filter gate before any rule can run, which is why a rule doc on its own would never have been reachable.This adds
.dhallto the allowlist and registers one rule doc inpath_rule_map:**/*.dhall→dhall.md. Data only, no Go source changes.The headline check is a remote import by URL with no trailing
sha256:<hex>integrity hash. Dhall resolves those over the network when the file is evaluated, so an unpinned import hands whoever controls that URL control of the configuration, and the content it returns can change between two evaluations of the same file.dhall freezewrites the hash.Two carve-outs keep that check usable. The Prelude's
missing sha256:<hex> ? ./local.dhallidiom is a content-addressed cache lookup with a working local fallback rather than an unpinned import, and it sits at the top of nearly every file that imports the Prelude. Bare relative imports (./types.dhall) are the overwhelming majority of imports in a project and pinning them is not the convention. The totality section carves outNatural/foldandList/foldfor the same reason: folds are how iteration is written in a language with no recursion, so flagging them would fire on almost every file.No exclude patterns are added.
IsExcludedPathapplies every pattern to every path with no language dispatch, so a pattern is only worth its repo-wide reach when it matches paths that are reliably test-only or generated. Dhall has neither in tree. Its import cache lives under$XDG_CACHE_HOME/dhall, outside the repository, so it never appears in a diff, and there is no vendored dependency directory or build output to skip.Limitation
.dhalldiffs that used to be skipped are now reviewed. Anyone who does not want that opts out with user exclude globs, which are checked before the allowlist.Type of Change
How Has This Been Tested?
make testpasses locallyRows appended to the existing table tests:
TestIsAllowedExt—.dhalland.DHALL.TestResolve_DefaultRules—config/prod.dhallandschemas/package.dhallresolve by a heading anchor unique todhall.md.Checklist
go fmt,go vet)The rule table in
pages/src/content/docs/{en,ja,ru,zh}/review-rules.mdlists the new pattern.Related Issues
Part of #470.