jeremybanka / wayforge

TypeScript monorepo. Home of Atom.io.
https://atom.io.fyi
3 stars 2 forks source link

atom.io consolidate devtools #2460

Closed jeremybanka closed 2 months ago

jeremybanka commented 2 months ago

User description


PR Type

Enhancement, Tests


Description


Changes walkthrough πŸ“

Relevant files
Tests
5 files
realtime-continuity.test.tsx
Increase test timeout for better reliability                         

packages/atom.io/__tests__/experimental/realtime/realtime-continuity.test.tsx - Increased test timeout to 10000 milliseconds.
+1/-1     
grace.test.ts
Add tests for internal debugging warnings                               

packages/atom.io/__tests__/private/grace.test.ts - Added tests for internal debugging warnings.
+23/-0   
AtomIODevtools.test.tsx
Add tests for AtomIODevtools state and transaction views 

packages/atom.io/__tests__/private/introspection/AtomIODevtools.test.tsx
  • Added new test file for AtomIODevtools.
  • Implemented tests for state and transaction views.
  • +147/-1 
    ReactErrorBoundary.test.tsx
    Simplify ReactErrorBoundary test setup                                     

    packages/atom.io/__tests__/private/introspection/ReactErrorBoundary.test.tsx - Simplified error boundary test setup.
    +5/-22   
    silo.test.ts
    Add subscription tests for state changes                                 

    packages/atom.io/__tests__/public/silo.test.ts - Added subscription tests for state changes.
    +8/-0     
    Miscellaneous
    5 files
    sprawl.test.ts
    Update import path for sprawl                                                       

    packages/atom.io/__tests__/private/introspection/sprawl.test.ts - Updated import path for sprawl.
    +1/-1     
    walk.ts
    Remove unneeded case in walk function                                       

    packages/atom.io/eslint-plugin/src/walk.ts - Removed unneeded case for FunctionDeclaration.
    +0/-1     
    differ.ts
    Update import path for sprawl in differ                                   

    packages/atom.io/introspection/src/differ.ts - Changed import path for `sprawl`.
    +1/-1     
    sprawl.ts
    Update import path for isPlainObject in sprawl                     

    packages/atom.io/introspection/src/sprawl.ts - Updated import path for `isPlainObject`.
    +1/-1     
    test-utils.ts
    Remove unused test utilities                                                         

    packages/hamr/react-error-boundary/src/test-utils.ts - Removed unused test utilities.
    +0/-6     
    Enhancement
    29 files
    operation.ts
    Refactor operation functions and improve logging                 

    packages/atom.io/internal/src/operation.ts
  • Changed parameter order for openOperation, isDone, and markDone.
  • Updated logger to use error instead of warn.
  • +7/-7     
    create-writable-selector.ts
    Update markDone function call in selector                               

    packages/atom.io/internal/src/selector/create-writable-selector.ts - Updated `markDone` function call with new parameter order.
    +1/-1     
    become.ts
    Simplify become function implementation                                   

    packages/atom.io/internal/src/set-state/become.ts - Simplified `become` function implementation.
    +1/-3     
    evict-downstream.ts
    Update function calls in evictDownStream                                 

    packages/atom.io/internal/src/set-state/evict-downstream.ts
  • Updated isDone and markDone function calls with new parameter order.
  • +2/-2     
    set-atom.ts
    Update markDone function call in setAtom                                 

    packages/atom.io/internal/src/set-state/set-atom.ts - Updated `markDone` function call with new parameter order.
    +1/-1     
    set-into-store.ts
    Update openOperation function call in setIntoStore             

    packages/atom.io/internal/src/set-state/set-into-store.ts - Updated `openOperation` function call with new parameter order.
    +1/-1     
    refinery.ts
    Extract isPlainObject function for reuse                                 

    packages/atom.io/introspection/src/refinery.ts - Extracted `isPlainObject` function for reuse.
    +9/-7     
    index.ts
    Add JSON type names and defaults                                                 

    packages/atom.io/json/src/index.ts - Added JSON type names and defaults.
    +29/-0   
    StateEditor.tsx
    Update imports and remove schema prop in StateEditor         

    packages/atom.io/react-devtools/src/StateEditor.tsx
  • Updated import paths for ElasticInput and JsonEditor.
  • Removed schema prop from JsonEditor.
  • +4/-9     
    ElasticInput.tsx
    Add ElasticInput component                                                             

    packages/atom.io/react-devtools/src/elastic-input/ElasticInput.tsx - Added new `ElasticInput` component.
    +87/-1   
    NumberInput.tsx
    Refactor number input constraints and clamping                     

    packages/atom.io/react-devtools/src/elastic-input/NumberInput.tsx - Refactored number input constraints and clamping logic.
    +8/-6     
    TextInput.tsx
    Add TextInput component                                                                   

    packages/atom.io/react-devtools/src/elastic-input/TextInput.tsx - Added new `TextInput` component.
    +44/-1   
    index.ts
    Export components from elastic-input                                         

    packages/atom.io/react-devtools/src/elastic-input/index.ts - Exported components from `elastic-input` directory.
    +4/-1     
    DefaultFallback.tsx
    Add DefaultFallback component for error boundaries             

    packages/atom.io/react-devtools/src/error-boundary/DefaultFallback.tsx - Added `DefaultFallback` component for error boundaries.
    +50/-1   
    ReactErrorBoundary.tsx
    Add ErrorBoundary and RecoverableErrorBoundary components

    packages/atom.io/react-devtools/src/error-boundary/ReactErrorBoundary.tsx - Added `ErrorBoundary` and `RecoverableErrorBoundary` components.
    +90/-1   
    index.ts
    Export error boundary components                                                 

    packages/atom.io/react-devtools/src/error-boundary/index.ts - Exported error boundary components.
    +0/-1     
    index.ts
    Export error-boundary from index                                                 

    packages/atom.io/react-devtools/src/index.ts - Exported `error-boundary` from index.
    +1/-0     
    default-components.tsx
    Update ErrorBoundary import and Button props                         

    packages/atom.io/react-devtools/src/json-editor/default-components.tsx
  • Updated ErrorBoundary import path.
  • Made Button props optional.
  • +2/-2     
    developer-interface.tsx
    Remove schema-related code from developer interface           

    packages/atom.io/react-devtools/src/json-editor/developer-interface.tsx - Removed schema-related code.
    +2/-9     
    array-editor.tsx
    Update ArrayEditor props type                                                       

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/array-editor.tsx - Updated type for `ArrayEditor` props.
    +2/-2     
    non-json.tsx
    Update ElasticInput import path in non-json editor             

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/non-json.tsx - Updated import path for `ElasticInput`.
    +1/-2     
    object-editor.tsx
    Simplify object editor and remove schema logic                     

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/object-editor.tsx - Removed schema-related logic. - Simplified property handling.
    +15/-60 
    primitive-editors.tsx
    Update ElasticInput import path in primitive editors         

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/primitive-editors.tsx - Updated import path for `ElasticInput`.
    +1/-1     
    array-elements.ts
    Update type for makeElementSetters                                             

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/array-elements.ts - Updated type for `makeElementSetters`.
    +3/-3     
    cast-json.ts
    Add utility functions for casting JSON                                     

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/cast-json.ts - Added utility functions for casting JSON.
    +58/-1   
    cast-to-json.ts
    Update castToJson function for unknown input                         

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/cast-to-json.ts - Updated `castToJson` function to handle unknown input.
    +6/-10   
    object-properties.ts
    Refactor property utilities with fromEntries                         

    packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/object-properties.ts - Refactored property utility functions to use `fromEntries`.
    +58/-49 
    index.ts
    Add SetterOrUpdater type                                                                 

    packages/atom.io/react-devtools/src/json-editor/index.ts - Added `SetterOrUpdater` type.
    +5/-2     
    json-editor-internal.tsx
    Simplify JsonEditor_INTERNAL and remove schema logic         

    packages/atom.io/react-devtools/src/json-editor/json-editor-internal.tsx - Removed schema-related code. - Simplified component logic.
    +26/-25 
    Documentation
    1 files
    todo.md
    Add TODO list for JSON editor improvements                             

    packages/atom.io/react-devtools/src/json-editor/todo.md - Added TODO list for JSON editor improvements.
    +8/-1     
    Configuration changes
    1 files
    tsconfig.json
    Update include paths in tsconfig                                                 

    packages/anvl/tsconfig.json - Updated include paths in tsconfig.
    +1/-6     
    Dependencies
    1 files
    pnpm-lock.yaml
    Update pnpm lockfile with new dependencies                             

    pnpm-lock.yaml - Updated lockfile with new dependencies.
    +1/-11   

    πŸ’‘ PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    vercel[bot] commented 2 months ago

    The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

    Name Status Preview Comments Updated (UTC)
    atom-io-fyi βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Aug 28, 2024 2:54am
    wayfarer-quest βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Aug 28, 2024 2:54am
    changeset-bot[bot] commented 2 months ago

    πŸ¦‹ Changeset detected

    Latest commit: adb8cca8efc515226c8edc0340160e507d6284f8

    The changes in this PR will be included in the next version bump.

    This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | atom.io | Patch |

    Not sure what this means? Click here to learn what changesets are.

    Click here if you're a maintainer who wants to add another changeset to this PR

    github-actions[bot] commented 2 months ago

    PR Reviewer Guide πŸ”

    ⏱️ Estimated effort to review: 4 πŸ”΅πŸ”΅πŸ”΅πŸ”΅βšͺ
    πŸ§ͺ PR contains tests
    πŸ”’ No security concerns identified
    ⚑ Key issues to review

    Refactoring Issue
    The refactoring of `isDone` and `markDone` functions changed the logging level from `warn` to `error`. This change could potentially lead to a different handling of operational logs which might not be intended. Ensure that this change aligns with the intended error handling and logging strategy. Schema Removal
    The removal of the `schema` property from `JsonEditor` might affect the validation or structure checks that were previously in place. Verify that removing schema handling does not affect the functionality where JSON data structure validation is critical. Test Modification
    The test for `ReactErrorBoundary` has been simplified by removing error count checks. This change might reduce the thoroughness of the test. Consider the implications of not checking the exact number of errors expected during the component's operation.
    github-actions[bot] commented 2 months ago

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Add error handling for number conversion to prevent runtime errors ___ **Consider adding error handling for the Number constructor in the stringToNumber
    function to handle cases where the string is not a valid number. This can prevent
    potential runtime errors due to NaN values.** [packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/cast-json.ts [4]](https://github.com/jeremybanka/wayforge/pull/2460/files#diff-254c074ac26a3bb6ca05f497eee8a9a9d8f3f34ba74d626280bbe0dee39b4ef6R4-R4) ```diff -export const stringToNumber = (str: string): number => Number(str) +export const stringToNumber = (str: string): number => { + const num = Number(str); + if (isNaN(num)) { + throw new Error(`Invalid number: ${str}`); + } + return num; +} ```
    Suggestion importance[1-10]: 9 Why: The suggestion correctly identifies a potential runtime error when converting strings to numbers. Adding error handling for invalid number conversions is crucial to prevent unexpected behavior and improve robustness.
    9
    Possible issue
    Handle cases where number conversion might result in NaN ___ **Refactor the objectToNumber function to handle cases where none of the properties
    (number, size, count) are present, to avoid returning NaN.** [packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/cast-json.ts [18-19]](https://github.com/jeremybanka/wayforge/pull/2460/files#diff-254c074ac26a3bb6ca05f497eee8a9a9d8f3f34ba74d626280bbe0dee39b4ef6R18-R19) ```diff -export const objectToNumber = (obj: Json.Tree.Object): number => - Number(obj.number ?? obj.size ?? obj.count ?? 0) +export const objectToNumber = (obj: Json.Tree.Object): number => { + const result = Number(obj.number ?? obj.size ?? obj.count); + return isNaN(result) ? 0 : result; +} ```
    Suggestion importance[1-10]: 9 Why: The suggestion addresses a potential issue where the function could return `NaN`, which is undesirable. Handling this case improves the function's reliability and correctness.
    9
    Enhancement
    Improve error logging for JSON parsing failures ___ **In the stringToObject function, consider providing a more informative error message
    in the catch block to aid debugging when JSON parsing fails.** [packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/cast-json.ts [6-11]](https://github.com/jeremybanka/wayforge/pull/2460/files#diff-254c074ac26a3bb6ca05f497eee8a9a9d8f3f34ba74d626280bbe0dee39b4ef6R6-R11) ```diff try { return JSON.parse(str) } catch (e) { + console.error(`Failed to parse string as JSON: ${str}`, e); return { [str]: str } } ```
    Suggestion importance[1-10]: 8 Why: Improving error logging for JSON parsing failures is beneficial for debugging and maintenance, making it easier to identify and resolve issues.
    8
    Performance
    Avoid unnecessary property renaming operations ___ **In the makePropertyRenamers function, consider checking if newKey is different from
    key before proceeding with renaming to avoid unnecessary operations.** [packages/atom.io/react-devtools/src/json-editor/editors-by-type/utilities/object-properties.ts [30-41]](https://github.com/jeremybanka/wayforge/pull/2460/files#diff-df0adef5b5334e5f5f7a1cf1e68bd3a2eb327c1954f454f7d59e342882fa24e8R30-R41) ```diff -if (!Object.hasOwn(data, newKey)) { +if (key !== newKey && !Object.hasOwn(data, newKey)) { set(() => { const entries = Object.entries(data) const index = entries.findIndex(([k]) => k === key) entries[index] = [newKey, value] const stableKeyMap = stableKeyMapRef.current stableKeyMapRef.current = { ...stableKeyMap, [newKey]: stableKeyMap[key], } return Object.fromEntries(entries) as T }) } ```
    Suggestion importance[1-10]: 7 Why: The suggestion improves performance by avoiding unnecessary operations, which is a good practice for optimizing code efficiency, although it is not critical.
    7
    coveralls commented 2 months ago

    Coverage Status

    coverage: 92.419% (+0.4%) from 92.05% when pulling adb8cca8efc515226c8edc0340160e507d6284f8 on atom.io-consolidate-devtools into 1e33475a6ce10be4712cd97f035b4b1fce4932fb on main.