-
Notifications
You must be signed in to change notification settings - Fork 5
feat: benchmark details refinement #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Y3drk
wants to merge
29
commits into
main
Choose a base branch
from
y3drk/feat/benchmark-details-refinement
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 20 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b514519
Add 1st draft of the new types
Y3drk d7278fd
Refactor data to match the drafted data model + add mock images and a…
Y3drk 8e692b6
Basic UI adaptation to the new data model, pt. 1
Y3drk f35b9b5
Basic UI adaptation to the new data model, pt.2
Y3drk 2fce38b
Apply ai assistant's suggestions, pt.1
Y3drk d7e3f4c
Refine apps' benchmarks data organization
Y3drk 5ef4e6f
JSDocs improvements, pt.1
Y3drk cb4969c
Refine best practices data organization
Y3drk 9ae8c2d
Adjust UI according to established goals
Y3drk eaec4c3
Update CONTRIBUTING.md and polish some JSDocs
Y3drk 1b96f1a
Apply ai assistant's suggestions, pt.2
Y3drk 9e9aa00
Apply 05/08/26 review feedback (GitHub + Google Doc), pt.1 - majority…
Y3drk bb1b2c6
Remove all placeholder content and align acceptance test benchmark re…
Y3drk 0c060b6
Apply 05/11/26 Slack feedback
Y3drk 8dd6549
Apply ai assistant's suggestions, pt.3
Y3drk 5542d92
Resolve conflicts with main
Y3drk e6773bf
UI double-check + initial work on technical details content refinement
Y3drk e79ae89
Apply ai assistant's suggestions, pt.4
Y3drk 7efbbef
Fix audited dependency vulnerabilities
Y3drk 2d93d38
Apply 05/11/26 Google doc feedback
Y3drk 161dd35
Apply 05/12/26 GitHub review feedback
Y3drk 9faf4b4
Apply ai assistant's suggestions, pt.5
Y3drk 8d3a637
Apply 05/12/26 Google Doc UI feedback
Y3drk afd0fbd
Apply ai assistant's suggestions, pt.6
Y3drk d4a4482
Apply ai assistant's suggestions, pt.7 + minor fixes after self-review
Y3drk 25d43d7
Apply 05/13/26 GitHub review feedback
Y3drk 35c7e4a
Apply ai assistant's suggestions, pt.8
Y3drk c935f7f
Upload final versions of adjusted contract naming season OG images
Y3drk 1870bc0
Apply ai assistant's suggestions, pt.9
Y3drk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { ACCEPTANCE_TESTS } from "data/acceptance-tests"; | ||
| import { isValidSlug } from "data/shared/slugs"; | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { areStringsUnique } from "@/utils"; | ||
|
|
||
| describe("Acceptance test data", () => { | ||
| it("Should have valid and unique slugs", () => { | ||
| const slugArray: string[] = []; | ||
|
|
||
| ACCEPTANCE_TESTS.forEach((acceptanceTest) => { | ||
| expect( | ||
| isValidSlug(acceptanceTest.acceptanceTestSlug), | ||
| `Slug={${acceptanceTest.acceptanceTestSlug}} is not valid`, | ||
| ).toEqual(true); | ||
|
|
||
| slugArray.push(acceptanceTest.acceptanceTestSlug); | ||
| }); | ||
|
|
||
| expect(areStringsUnique(slugArray), `Slugs for Acceptance Tests are not unique`).toEqual(true); | ||
| }); | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { ENS_BEST_PRACTICES } from "data/ens-best-practices"; | ||
|
|
||
| export const ACCEPTANCE_TESTS = [ | ||
| ...ENS_BEST_PRACTICES.flatMap((bestPractice) => bestPractice.technicalDetails.acceptanceTests), | ||
| ]; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import { type BenchmarkResult, BenchmarkResults } from "data/benchmarks/types"; | ||
| import type { Contribution } from "data/contributors/types"; | ||
| import type { JSX } from "react"; | ||
|
|
||
| /** A unique identifier for an acceptance test. | ||
| * | ||
| * @invariant Must be unique across all acceptance tests. | ||
| * @invariant Must match {@link ENSAWARDS_SLUG_PATTERN}. | ||
| */ | ||
| export type AcceptanceTestSlug = string; | ||
|
|
||
| /** | ||
| * Represents an acceptance test that an app can be evaluated against. | ||
| */ | ||
| export interface AcceptanceTest { | ||
|
lightwalker-eth marked this conversation as resolved.
|
||
| /** | ||
| * Unique identifier for the acceptance test. | ||
| */ | ||
| acceptanceTestSlug: AcceptanceTestSlug; | ||
|
|
||
| /** | ||
| * Description of the acceptance test, which should provide clear and detailed information | ||
|
Y3drk marked this conversation as resolved.
Outdated
|
||
| * about the criteria and requirements that an {@link App} must meet to pass the test. | ||
| * This may include specific functionalities to be tested, user interactions to be evaluated, and any relevant technical details or considerations. | ||
| * | ||
| * @note The description should not include examples of passed or failed benchmarks, there are dedicated fields for that | ||
| * (see {@link AcceptanceTest.examplePass}, {@link AcceptanceTest.examplePartialPass}, or {@link AcceptanceTest.exampleFail}). | ||
| */ | ||
| description: JSX.Element; | ||
|
|
||
| /** | ||
| * Examples of benchmark results that illustrate what a passing, partially passing, or failing result looks like for this acceptance test. | ||
|
Y3drk marked this conversation as resolved.
Outdated
|
||
| */ | ||
| examplePass: AcceptanceTestBenchmarkPass; | ||
| examplePartialPass?: AcceptanceTestBenchmarkPartialPass; | ||
| exampleFail?: AcceptanceTestBenchmarkFail; | ||
| } | ||
|
|
||
| /** | ||
| * Represents the benchmark of an {@link AcceptanceTest} on an {@link App} against a {@link BestPractice}. | ||
| */ | ||
| export interface AcceptanceTestBenchmarkAbstract<BenchmarkResultT extends BenchmarkResult> { | ||
| /** The result of the benchmark */ | ||
| result: BenchmarkResultT; | ||
|
|
||
| /** A record of all contributors involved in the addition or maintenance of the benchmark's data. | ||
| * | ||
| * @invariant Multiple {@link Contribution} from the same contributor on the same app benchmark are not allowed. | ||
| * When a contributor makes updates to their existing contribution, | ||
| * they should update the `lastUpdated` timestamp of their existing `Contribution`. | ||
| */ | ||
| contributions: [Contribution, ...Contribution[]]; | ||
|
|
||
| /** | ||
| * Notes about how the benchmark result was determined, which may include details about the testing process, | ||
| * any challenges encountered, and explanations, as well as a visual proof, for the final result. | ||
| */ | ||
| notes: JSX.Element; | ||
| } | ||
|
|
||
| /** | ||
| * Represents a benchmark of an {@link AcceptanceTest} on an {@link App} against a {@link BestPractice}, | ||
| * that has fully passed our criteria. | ||
| */ | ||
| export interface AcceptanceTestBenchmarkPass | ||
| extends AcceptanceTestBenchmarkAbstract<typeof BenchmarkResults.Pass> {} | ||
|
|
||
| /** | ||
| * Represents a benchmark of an {@link AcceptanceTest} on an {@link App} against a {@link BestPractice}, | ||
| * that has partially passed our criteria. | ||
| */ | ||
| export interface AcceptanceTestBenchmarkPartialPass | ||
| extends AcceptanceTestBenchmarkAbstract<typeof BenchmarkResults.PartialPass> {} | ||
|
|
||
| /** | ||
| * Represents a benchmark of an {@link AcceptanceTest} on an {@link App} against a {@link BestPractice}, | ||
| * that hasn't passed our criteria. | ||
| */ | ||
| export interface AcceptanceTestBenchmarkFail | ||
| extends AcceptanceTestBenchmarkAbstract<typeof BenchmarkResults.Fail> {} | ||
|
|
||
| export type AcceptanceTestBenchmark = | ||
| | AcceptanceTestBenchmarkPass | ||
| | AcceptanceTestBenchmarkPartialPass | ||
| | AcceptanceTestBenchmarkFail; | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import { ACCEPTANCE_TESTS } from "data/acceptance-tests"; | ||
| import type { | ||
| AcceptanceTest, | ||
| AcceptanceTestBenchmark, | ||
| AcceptanceTestSlug, | ||
| } from "data/acceptance-tests/types"; | ||
| import type { AppSlug } from "data/apps/types"; | ||
| import { | ||
| type AcceptanceTestBenchmarks, | ||
| type BenchmarkResult, | ||
| BenchmarkResults, | ||
| } from "data/benchmarks/types"; | ||
| import { getAppBenchmarks } from "data/benchmarks/utils.ts"; | ||
|
|
||
| /** Returns an {@link AcceptanceTest} by {@link AcceptanceTestSlug}. */ | ||
| export const getAcceptanceTestBySlug = (slug: AcceptanceTestSlug): AcceptanceTest | undefined => { | ||
| return ACCEPTANCE_TESTS.find((acceptanceTest) => acceptanceTest.acceptanceTestSlug === slug); | ||
| }; | ||
|
|
||
| /** Returns all {@link AcceptanceTestBenchmark}s of an `App` by {@link AppSlug}. */ | ||
| export const getAcceptanceTestBenchmarksByApp = ( | ||
| appSlug: AppSlug, | ||
| ): (AcceptanceTestBenchmark | undefined)[] => { | ||
| const appBenchmarks = getAppBenchmarks(appSlug); | ||
|
|
||
| return Object.values(appBenchmarks).flatMap((acceptanceTestBenchmarks) => | ||
| Object.values(acceptanceTestBenchmarks), | ||
| ); | ||
| }; | ||
|
|
||
| /** | ||
| * Generalizes multiple `AcceptanceTestBenchmark`s into a single `BenchmarkResult` based on the following rules: | ||
| * - Returns {@link BenchmarkResults.Pass} if all defined benchmarks are {@link BenchmarkResults.Pass} or {@link BenchmarkResults.PartialPass} | ||
| * - Returns {@link BenchmarkResults.Fail} if all defined benchmarks are {@link BenchmarkResults.Fail}, | ||
| * - Returns {@link BenchmarkResults.PartialPass} if: | ||
| * - at least one defined benchmark is {@link BenchmarkResults.Fail} and at least one defined benchmark is {@link BenchmarkResults.Pass} or {@link BenchmarkResults.PartialPass}, | ||
| * - or all defined benchmarks are {@link BenchmarkResults.PartialPass}, | ||
| * - returns `undefined` if all benchmarks are `undefined` (pending). | ||
| */ | ||
| export const generalizeAcceptanceTestBenchmarks = ( | ||
| acceptanceTestBenchmarks: AcceptanceTestBenchmarks, | ||
| ): BenchmarkResult | undefined => { | ||
| const benchmarkResults = Object.values(acceptanceTestBenchmarks).map( | ||
|
Y3drk marked this conversation as resolved.
|
||
| (benchmark) => benchmark?.result, | ||
| ); | ||
|
|
||
| // Explicitly treating passs and partial pass equally | ||
|
Y3drk marked this conversation as resolved.
Outdated
Y3drk marked this conversation as resolved.
Outdated
|
||
| const hasPass = benchmarkResults.some( | ||
| (result) => result === BenchmarkResults.Pass || result === BenchmarkResults.PartialPass, | ||
| ); | ||
| const hasFail = benchmarkResults.some((result) => result === BenchmarkResults.Fail); | ||
|
|
||
| const allPartialPass = benchmarkResults.every( | ||
| (result) => result === BenchmarkResults.PartialPass, | ||
| ); | ||
|
|
||
| if ((hasPass && hasFail) || allPartialPass) { | ||
| return BenchmarkResults.PartialPass; | ||
|
Y3drk marked this conversation as resolved.
|
||
| } | ||
|
|
||
| if (hasPass) { | ||
| return BenchmarkResults.Pass; | ||
| } | ||
|
|
||
| if (hasFail) { | ||
|
Y3drk marked this conversation as resolved.
Outdated
Y3drk marked this conversation as resolved.
Outdated
|
||
| return BenchmarkResults.Fail; | ||
| } | ||
|
|
||
| return undefined; | ||
| }; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.