Conversation
Split the crate into a library and a thin binary so the application can be built from tests, and move date-range, name-ordering and image-URL logic out of the resolvers into pure functions. Behaviour is unchanged. - Unit tests, with proptest invariants, for date ranges, the Date and DateTime scalars, post cursors, connection page info, Hungarian ordering of colleague names, post image URLs and configuration parsing. - insta snapshot of the GraphQL SDL, so API changes show up in review. - Bugs found while writing the tests are recorded as #[ignore = "bug: ..."] tests and will be fixed in separate PRs. - CI runs on pull requests, uses maintained actions and cargo-nextest, and lints test code. Job names are unchanged for branch protection. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: TwoDCube The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
With the default fail-fast matrix, a failing advisories check cancelled the bans/licenses/sources check, so license problems were never reported. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 14, 2026
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.
Step 1 of 3 in adding a test suite (1: unit tests + schema snapshot + CI, 2: MySQL/Redis integration and response snapshot tests, 3: one PR per bug found).
What changes
Library/binary split.
src/lib.rsnow holdsConfig,AppState,app()andrun();src/main.rsonly reads the environment, connects and serves. Nothing in the library reads env vars or opens connections itself:graphql::build_schematakes the persisted-query cache as an argument instead of connecting to Redis, andAppState::newtakes the schema, database and config.Logic moved out of resolvers, extraction only, no behaviour change:
utils/date_range.rs:month_range(archive),calendar_grid_range(events),iso_week_range(canteen)colleagues::compare_names: Hungarian collation, ignoring aDr.prefixposts::image_urls: turns theimagesJSON (array or object) into URLsTests: 53 unit tests, some with proptest invariants:
Date/DateTimescalars andPostCursorencode/decode round-tripshasPreviousPage= "older posts exist" meaning, since website_frontend2 requests these fieldsAPI contract snapshot.
instasnapshotsschema.sdl()(src/graphql/snapshots/). Adding, renaming or removing a field, or changing its type or nullability, now appears as a diff in the PR.CI (
.github/workflows/ci.yml):pull_requestand pushes tomaster; branch pushes without a PR no longer trigger itactions-rs/*actions withdtolnay/rust-toolchain,Swatinem/rust-cache@v2andactions/checkout@v7cargo-nextest, plus doctests--all-targets, so test code is linted tooBuild/Format/Clippy/Testare unchanged, because branch protection requires themDocs:
docs/testing.mdcovers how to run the tests, update snapshots and handle known bugs.Bugs found (ignored tests, fixed in follow-up PRs)
calendar_grid_ends_after_the_sunday_of_the_last_week(+ proptest)events(year, month)stops one day before the end of the calendar grid, so events on the grid's last Sunday are missing. When the next month starts on a Monday it adds a spare 6 days instead.calendar_grid_does_not_panic_at_the_earliest_representable_monthevents(year: -262143, month: 1)overflows chrono and panics, returning HTTP 500.parses_the_format_it_emitsDateTimescalar documents and emitsYYYY-MM-DD HH:MM:SS, but its parser only acceptsYYYY-MM-DDTHH:MM:SS.cargo nextest list --run-ignored onlylists them.Verification
cargo fmt --checkpasses;cargo clippy --locked --all-targets -- -D warningsis clean.cargo nextest run --all-targets: 53 passed, 4 skipped (the known bugs). A second run withoutINSTA_UPDATEpasses, so the snapshot is stable.cargo deny check bans licenses sourcespasses with the new dev-dependencies (insta,proptest). Theadvisoriesfindings (h2, rustls, proc-macro-error2) already exist onmaster.🤖 Generated with Claude Code