Skip to content

chore: add optional advisory TinyNod review to pre-push - #3275

Merged
interactivellama merged 2 commits into
masterfrom
chore/tinynod-local-review
Nov 2, 2026
Merged

interactivellama merged 2 commits into
masterfrom
chore/tinynod-local-review

Conversation

@interactivellama

@interactivellama interactivellama commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Infra/review only. Does not touch production code.

Additional description

Adds an opt-in, advisory TinyNod AI review to the husky pre-push hook for Salesforce employees, and tells coding agents (via AGENTS.md) to suggest it and report its result honestly. Modeled on salesforce/zana's TinyNod setup, much reduced: no snapshot worktree, lock or history ledger.

Behavior

  • Off by default. When not opted in, the hook prints nothing and never calls tinynod, so external contributors and CI are unaffected.
  • Opt in with git config --local dsr.tinynod.enabled true. DSR_TINYNOD_REVIEW=1|0 overrides it for one push, and TINYNOD_SKIP_HOOK=1 skips it.
  • Runs after the snapshot check (so a failing snapshot check still blocks the push first), with a 300 s budget. It always exits 0. The result comes from TinyNod's JSON, not its exit code, and a timeout, error or non-JSON output is reported as warning, never clean.
  • Review base: the remote branch's previous tip if it is an ancestor (only new commits), otherwise the merge-base with origin/master.
  • Skips, with a logged reason: missing tinynod or a version older than 2.5.0, pushes to master/tags, deletions, multi-commit pushes, a pushed commit that is not HEAD, and docs-only pushes.

Files

  • scripts/tinynod-pre-push-review.ts: the adapter, run with tsx like release.ts
  • .husky/pre-push: captures the ref tuples, runs snapshots, then the adapter (|| true)
  • AGENTS.md / docs/codebase-overview.md: new scripts in scripts/ are TypeScript (.ts + tsx, type-checked by tsconfig.scripts.json)
  • docs/tinynod-local-review.md: setup, opt-in/out, results, AI fix prompt, troubleshooting, data policy
  • CONTRIBUTING.md: a short "Optional: Local TinyNod Review (Salesforce Employees)" section
  • AGENTS.md: agents suggest it when it isn't configured, don't enable it themselves, report status/skip reasons, and never use skip flags to hide findings
  • scripts/__tests__/tinynod-pre-push-review.test.mjs: 16 tests. End-to-end runs use a stub tinynod in a throwaway repo, so nothing reaches the gateway.

Hand-checked against the real hook, including a live TinyNod 2.5.1 review (6 low-value findings, all false positives): when opted out, only the snapshot check runs. When opted in with no tinynod on PATH, it prints skipped: tinynod not found on PATH and the push continues.


CONTRIBUTOR checklist (do not remove)

Please complete for every pull request.

Green gate — all of these must pass locally (CI runs the same):

  • npm run lint passes with 0 errors (npm run lint:fix to auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.
  • npm run typecheck is clean (tsc --noEmit).
  • npm test -- --run passes — this runs both Vitest projects (jsdom unit + real-browser browser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots with npm test -- --run -u and review the diff.
  • npm run build succeeds (type-check + Vite library build + .d.ts + entry shims). Fails on master too, in test:exports (utilities/hooks is missing its default export in ESM/CJS). Not related to this PR.

Behavior & docs:

  • First-time contributors: sign the CLA (a bot will comment with instructions).
  • Added/updated Vitest + React Testing Library tests for the change (template: components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a *.browser.test.jsx file (the browser project); everything else is jsdom.
  • Reviewed the component's Storybook stories: npm run storybook → http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server). N/A, tooling only.
  • Story/example code uses the component's real prop API (e.g. slots like content / visualPickerFigure, render props like renderItem, icon props, events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check against components/<name>/__examples__. N/A.
  • Storybook Accessibility (a11y) panel shows no new violations for the affected stories. N/A.
  • If you added or changed a type, remember runtime PropTypes were removed in the TS migration — types are the contract. Ship accurate .d.ts (they're generated by the build); JS consumers rely on them via editor type-acquisition. N/A.

REVIEWER checklist (do not remove)

  • CI is green (GitHub Actions CI workflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.
  • Change has adequate test coverage; bug fixes include a regression test.
  • Reviewed the affected Storybook stories and their a11y panels.
  • Rendered markup still conforms to SLDS — check the story HTML snapshot diff (components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).
  • Public API / package surface: if exports changed, the deep-import contract still holds (@salesforce/design-system-react/components/<name> and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change → feat!:/BREAKING CHANGE: and a major version bump.

interactivellama and others added 2 commits November 2, 2026 10:15
Salesforce employees can opt in (git config dsr.tinynod.enabled true) to a
local TinyNod AI review of the pushed commit, run by the husky pre-push hook
after the snapshot check. It is off by default, prints nothing when not
opted in, never blocks a push, and CI never runs it. Adapted from
salesforce/zana's opt-in TinyNod hook.

Adds the setup guide, a CONTRIBUTING section, and AGENTS.md rules so coding
agents suggest it and report its result honestly.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Run scripts/tinynod-pre-push-review.ts with tsx, like release.ts, so
`npm run typecheck` covers it. Document that new scripts in scripts/ are
TypeScript.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@interactivellama
interactivellama force-pushed the chore/tinynod-local-review branch from 422b4fd to af438ba Compare November 2, 2026 19:11
@interactivellama
interactivellama merged commit b02e24f into master Nov 2, 2026
10 of 11 checks passed
@interactivellama
interactivellama deleted the chore/tinynod-local-review branch November 2, 2026 19:18
interactivellama pushed a commit that referenced this pull request Nov 12, 2026
Reverts b02e24f (#3275). The optional advisory review is being retired.
Keeps the unrelated "new scripts are TypeScript" guidance in AGENTS.md and
docs/codebase-overview.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant