Repository navigation
ci: one verified tool fetch, every check reported; no lint baselines - #16
Conversation
…plates 51 of the 94 bulk-suppressed violations were two rule settings, not code problems: - no-floating-promises flagged every top-level node:test test() call. The promise it returns only reports completion and is fulfilled whether the test passes or fails; the runner tracks the test. allowForKnownSafeCalls names node:test's test/it/describe/suite. - restrict-template-expressions (strictTypeChecked) rejects numbers. A number has one string form; booleans, null, arrays and objects stay errors, as before. Bulk suppressions count per file and rule, so a fixed violation can hide a new one in the same file. Fewer suppressed rules means fewer places where that can happen. Refs ardmn/work#16
…very check reported The lint and secrets jobs downloaded five tools with five copies of the same curl/sha256sum snippet, inside the linter steps: - A download happened after yarn lint and the tests, so an early failure skipped it, and the cache save ran at the end of the job (with always(), so also on cancelled runs). - A cached file that failed its checksum was never replaced: `[ -f ]` skipped the download, the check failed, and the save was skipped on a cache hit. Every run failed until the entry expired. - The lint job ran its checks fail-fast, so one failing check hid the others; the Android step ran unit tests and lint in one Gradle call without --continue, so a failing test hid lint. Now: - scripts/verified-download.ts owns "use a download only if its SHA-256 matches" for the scripts (bundletool in lib.ts, which had its own copy) and CI. A file already there is re-checked; one that fails is reported and downloaded again; a download is checked before it is written and renamed into place. Network errors, 5xx and 429 are retried. No dependencies, so the secrets job needs only Node, not a yarn install. - .github/actions/fetch-tool (the approach of remote-compose-storybook's action of the same name) restores the tool's cache entry, runs scripts/fetch-tool.ts (verify or download, extract from a zip or tar, install on PATH), and saves a new download right away. The lint job fetches all four tools before any check. - Each lint check runs with !cancelled() and skips only when what it needs did not install. In native-tests, the lockfile check and the Android step run after an earlier failure too, and Gradle gets --continue. - Quoted three shell expansions actionlint's shellcheck reported (SC2086) in the turbo and NDK steps, so actionlint passes on the whole file. A cache entry cannot be overwritten, so after a corrupted hit the job downloads on every run (with a warning naming the fix, gh cache delete) instead of failing. Refs ardmn/work#15
…ssions eslint-suppressions.json counted violations per file and rule, so fixing one violation let a new one of the same rule in that file through. The 43 left after the previous commit are fixed in code, except four lines that are right as they are and now carry an inline disable with the reason: - the two Metro asset require() calls for .rc files in documents.ts (Metro bundles an asset only through require()); - the two `=== null` checks in convert.ts that the types call impossible but JavaScript callers can still reach (a test passes a null source). The fixes that change behaviour: - productCardJson is deleted: no screen used it, it stayed only behind @knipignore, and it bundled product_card.json into both demos. The JSON stays as the source of product_card.rc. pulse.json is now a typed import, not an untyped require(). - PerformanceScreen: a run that throws logs RC_PERF_FAILED and stops showing "running…", instead of an unhandled rejection; measure-perf's timeout message names that marker. - App: a failing Linking.getInitialURL() is logged instead of an unhandled rejection. - convert.ts describe(): a function is described as "a function", not printed as its source. - measure-perf reads request bodies as UTF-8 across chunk boundaries and rejects only with Errors. - generate-native-contract: an enum without values or a struct without fields throws a message instead of a non-null assertion; list errors are joined with ", ". An unused inline disable is reported and fails yarn lint (--max-warnings 0), so each one is removed together with the finding it covers. Refs ardmn/work#16
…ns with reasons detekt's baseline matched an entry by file name and signature, so `TooGenericExceptionCaught: Main.kt$e: Exception` hid every `catch (e: Exception)` in any Main.kt, including new ones. Android Lint's baseline had two entries. Both baselines are gone; CI fails on any finding. detekt (9 entries): - MagicNumber, MaxLineLength (Main.kt): fixed (DIR_ARGUMENTS, the usage text split). - TooGenericExceptionCaught (x4), SpreadOperator, ThrowsCount, TooManyFunctions (x2): kept as they are, each with @Suppress on the narrowest element (the catch parameter, the expression, the function or class) and a comment saying why. Android Lint (2 entries): - UseKtx: Uri.parse(s) becomes s.toUri(). - ViewConstructor: @SuppressLint on RemoteComposeView, which React Native creates only through its view manager and never inflates from XML. CONTRIBUTING describes inline suppressions instead of the three baselines, and the fetch-tool action for CI's pinned linters. Refs ardmn/work#16
…lete Review findings on the fetch-tool action: - The cache key and path held only the tool name and its SHA-256. A version bump that changed the URL but not the pinned checksum restored the old file from a warm cache, which passed the check, and CI stayed green on the old version. The entry is now named after a hash of the URL and the checksum together, so a URL change always misses the cache, downloads, and fails the check. - The comment said a corrupted entry is re-downloaded until it is deleted "or expires", but an entry restored on every run never expires. The comment says so, and the warning now names the exact `gh cache delete <key>` command (the action passes CACHE_KEY). - The `downloaded` output fetch-tool.ts writes is now exposed by the action. - A pinned URL that does not parse is refused before any request, as a malformed checksum is. New tests: a 503 then 429 then 200 download succeeds on the third try; a malformed URL is refused; fetch-tool keeps a valid cached copy without a request; fetch-tool replaces a corrupted cached copy and prints the warning with the cache key. Refs ardmn/work#15
… no baseline - The JDK and the four Fetch steps kept the default `success()` condition, so one failed fetch or a failed yarn install skipped every later setup step, and with them every check that needs them. They now run with `!cancelled()`, and each check is skipped only when what it needs did not install: yarn checks on Setup, ktlint and detekt on the JDK and their fetch, the Swift tools on their fetch. - The Android step still said "new findings only" and pointed to android/lint-baseline.xml, which the previous change deleted. Refs ardmn/work#15
describe() in src/convert.ts now says "a function" instead of printing the function's source into the error message; nothing tested that. Named values of null and of a function are reported with "got null" and "got a function", and the function's source text is not in the message. Both tests fail against the previous describe(). Refs ardmn/work#16
toUri() comes from androidx.core:core-ktx, which the library does not declare; it compiled only
because the dependency arrives transitively. Declaring it would set a minimum core-ktx version for
every app that installs the library, for a one-line wrapper around Uri.parse. Uri.parse with
@SuppressLint("UseKtx") and the reason adds no consumer dependency.
Refs ardmn/work#16
|
No actionable comments were generated in the recent review. Walkthrough
Change: Other Merge Risk:
|
CI (ardmn/work#15)
.github/actions/fetch-tool(withscripts/fetch-tool.tsandscripts/verified-download.ts, Node built-ins only) installs ktlint, detekt, SwiftFormat, SwiftLint and gitleaks: cache keyed by URL + SHA-256, SHA-256 checked before use, a corrupted cached copy is replaced with a warning, saved right after verification. It replaces five copies of curl + sha256sum;scripts/lib.ts(bundletool) uses the same downloader.--continue.Baselines (ardmn/work#16)
node:testtop-level calls are known-safe for no-floating-promises, numbers allowed in template literals (as inrecommendedTypeChecked). What must stay is suppressed inline with a reason (ESLint 4, detekt 8, Android Lint 1).describe()in convert errors no longer prints a function's source; PerformanceScreen andgetInitialURLfailures are logged instead of unhandled rejections; unusedproductCardJsonremoved from the demo bundles.Fixes ardmn/work#15, ardmn/work#16
Summary by CodeRabbit