Conform the codebase to the contributing guidelines - #128
Merged
Conversation
Rebuild CONTRIBUTING.md on the philpax/contributing-templates baseline: a new opening, a sync marker pinned to upstream commit 57e7c55, and the five applicable templates (general, rust, typescript, react, tailwind) appended verbatim. Port the existing project-specific sections (backends, file-size limits, building emitted C++ on Linux, the language-change surface checklist, tests, editor tooling) into the new file without dropping content. Add AGENTS.md as a symlink to CONTRIBUTING.md so both agent entry points read the guide. CLAUDE.md already includes it via @CONTRIBUTING.md.
philpax
force-pushed
the
contributing-update
branch
from
August 10, 2026 11:59
bb527a8 to
dfbcb79
Compare
Enable the clippy restriction lints (unwrap_used, expect_used, panic, unreachable) as warnings with per-crate opt-in, and remove every production panic-family site: in-memory writes route through infallible_write!/infallible_writeln!, LSP serialization failures push up as error responses, and genuinely-reachable panics become structured errors (function body, unresolved types, stalled resolution). Provably unreachable ICEs carry a documented #[expect] with the proof. Rename src/util.rs to src/math.rs. Add an in-memory Fs seam (build_sources/check_sources) and route the filesystem-touching tests through it, staging the inherently-filesystem ones under target/test-artifacts. Add the first property tests (parser round-trip, cfg evaluation, StripLocations idempotence) and driver smoke tests. Emitted code in codegen_tests/output/rust is exempted at the crate boundary per the generated-code policy.
Wire eslint-plugin-better-tailwindcss with the correctness rules at error (line wrapping stays with prettier), and promote the react-hooks rules to error after restructuring every set-state-in-effect site. Convert all className template-fragment interpolations to the cn() helper (clsx + tailwind-merge), all interface declarations to type, and remove non-null assertions and unchecked casts. Add a zod schema mirroring the JsonDocumentation wire shape and route every untrusted JSON input through the parseJsonDocumentation boundary helper, with vitest unit tests. Split ItemView and Sidebar into cohesive sub-files under the line threshold. Add typecheck, format:check, and test scripts, and a types/tsconfig.json so the generated json.ts joins the tsc -b graph.
Property round-trip tests over the full JsonDocumentation shape are deliberately not implemented: the schema is versioned and the codegen corpus round-trips it end to end, so a second oracle implementation of the schema is disproportionate. Record the gap in the JSON backend docs.
test.py lints the viewer but does not run its unit tests. Add npm test (vitest) after the lint step so the JSON boundary validator is covered by CI, not only by local runs.
philpax
force-pushed
the
contributing-update
branch
from
August 10, 2026 13:16
dfbcb79 to
57825a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch brings the workspace into conformance with the contributing guidelines imported in commit 2dbc613. It does not change the language, the emitted code shapes, or any runtime behavior. It tightens existing lint and test gates and removes panic-prone code.
The Rust workspace gains clippy restriction lints (
unwrap_used,expect_used,panic,unreachable) as warnings, with each crate opting in via[lints] workspace = true. The pass removes every production panic-family site. In-memory formatting routes throughinfallible_write!andinfallible_writeln!. LSP serialization failures propagate as error responses. Genuinely reachable panics become structured compiler errors. Provably unreachable sites carry a documented#[expect]with the invariant stated. Thesrc/util.rsmodule is renamed tosrc/math.rs.The test suite gains an in-memory Fs seam (
build_sourcesandcheck_sources). Filesystem-touching tests route through it, or stage undertarget/test-artifactswhere the behavior under test is the real filesystem. The suite gains the first property tests: parser round-trip, cfg-predicate evaluation, andStripLocationsidempotence. The driver, which had no tests, gains smoke tests for its build and check decisions.The viewer enables
eslint-plugin-better-tailwindcsswith the correctness rules at error severity, and promotes the react-hooks rules to error. AllclassNametemplate-fragment interpolations becomecn()calls (clsx plus tailwind-merge). Allinterfacedeclarations become type aliases. Non-null assertions and unchecked casts are removed. Untrusted JSON passes through a zod schema before entering typed state, with vitest unit tests at the boundary.ItemViewandSidebarsplit into cohesive files under the line threshold. Thetypespackage joins thetsc -bgraph, andtypecheck,format:check, andtestscripts are added.Generated code in
codegen_tests/output/rustis exempt from the restriction lints at the crate boundary, through a per-crate allow with the rationale stated in the crate'sCargo.toml. The JSON wire round-trip property test gap is deliberate: a versioned, corpus-covered wire format does not justify a second oracle implementation. The gap is recorded in the JSON backend docs.Two constraints shape the viewer lint config. Prettier owns line wrapping, so the Tailwind line-wrapping rule is disabled; the correctness rules stay at error. The CodeBlock language class is dynamic by its nature and carries a documented exemption.
Verification:
python test.pypasses, including clippy with-D warningsfor both feature configurations, the full test suite, the codegen corpus, fmt, cargo doc, and the viewer unit tests. Viewerlint,typecheck,format:check,build, and vitest all pass. Review by nat-code-reviewer found no critical or major findings.