Skip to content

Conversation

epignatelli
Copy link
Owner

@epignatelli epignatelli commented Aug 15, 2025

Fixes #95

This implements the correct symbolic state of doors, which is currently incorrect, as highlighted in #95 -- thank you @rikifunt for the great catch.

As a byproduct, entities now have a symbolic_state property.

Copy link
Contributor

github-actions bot commented Aug 15, 2025

************* Module navix._version
navix/_version.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module navix.entities
navix/entities.py:81:0: C0301: Line too long (127/100) (line-too-long)
navix/entities.py:82:0: C0301: Line too long (117/100) (line-too-long)
navix/entities.py:88:0: C0301: Line too long (131/100) (line-too-long)
navix/entities.py:93:0: C0301: Line too long (140/100) (line-too-long)
navix/entities.py:98:0: C0301: Line too long (157/100) (line-too-long)
navix/entities.py:266:0: C0301: Line too long (105/100) (line-too-long)
navix/entities.py:267:0: C0301: Line too long (112/100) (line-too-long)
navix/entities.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/entities.py:26:0: R0903: Too few public methods (0/2) (too-few-public-methods)
navix/entities.py:40:0: R0903: Too few public methods (0/2) (too-few-public-methods)
navix/entities.py:55:0: R0903: Too few public methods (0/2) (too-few-public-methods)
navix/entities.py:84:15: E1101: Instance of 'Field' has no 'shape' member (no-member)
navix/entities.py:89:15: E1101: Instance of 'Field' has no 'ndim' member (no-member)
navix/entities.py:112:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:146:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:184:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:208:30: E1101: Instance of 'Field' has no 'shape' member (no-member)
navix/entities.py:226:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:230:8: W0622: Redefining built-in 'id' (redefined-builtin)
navix/entities.py:250:30: E1101: Instance of 'Field' has no 'shape' member (no-member)
navix/entities.py:273:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:278:8: W0622: Redefining built-in 'open' (redefined-builtin)
navix/entities.py:305:30: E1101: Instance of 'Field' has no 'shape' member (no-member)
navix/entities.py:314:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:339:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:360:30: E1101: Instance of 'Field' has no 'shape' member (no-member)
navix/entities.py:377:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:400:30: E1101: Instance of 'Field' has no 'shape' member (no-member)
navix/entities.py:417:4: C0116: Missing function or method docstring (missing-function-docstring)
navix/entities.py:440:30: E1101: Instance of 'Field' has no 'shape' member (no-member)
************* Module navix.observations
navix/observations.py:1:0: C0114: Missing module docstring (missing-module-docstring)
navix/observations.py:44:0: C0116: Missing function or method docstring (missing-function-docstring)
navix/observations.py:45:4: W0603: Using the global statement (global-statement)
navix/observations.py:49:9: W0613: Unused argument 'state' (unused-argument)
navix/observations.py:128:4: C0103: Variable name "H" doesn't conform to snake_case naming style (invalid-name)
navix/observations.py:128:7: C0103: Variable name "W" doesn't conform to snake_case naming style (invalid-name)
navix/observations.py:22:0: W0611: Unused import jax (unused-import)
navix/observations.py:28:0: W0611: Unused Directional imported from components (unused-import)
navix/observations.py:28:0: W0611: Unused Openable imported from components (unused-import)
navix/observations.py:30:0: W0611: Unused align imported from grid (unused-import)
navix/observations.py:30:0: W0611: Unused draw_grid_lines imported from grid (unused-import)
************* Module tests.issue_95
tests/issue_95.py:1:0: C0114: Missing module docstring (missing-module-docstring)
tests/issue_95.py:5:0: C0116: Missing function or method docstring (missing-function-docstring)
tests/issue_95.py:17:0: C0116: Missing function or method docstring (missing-function-docstring)
tests/issue_95.py:29:0: C0116: Missing function or method docstring (missing-function-docstring)
tests/issue_95.py:41:0: C0116: Missing function or method docstring (missing-function-docstring)


Report
======
302 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |4      |NC         |NC         |0.00        |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |12     |NC         |NC         |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |56     |NC         |NC         |83.93       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |12     |NC         |NC         |58.33       |0.00     |
+---------+-------+-----------+-----------+------------+---------+



External dependencies
---------------------
::

    navix 
      \-entities (tests.issue_95)



805 lines have been analyzed

Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |462    |57.39 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |118    |14.66 |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |83     |10.31 |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |142    |17.64 |NC       |NC         |
+----------+-------+------+---------+-----------+



Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |NC       |NC         |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |NC       |NC         |
+-------------------------+------+---------+-----------+



Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |27     |NC       |NC         |
+-----------+-------+---------+-----------+
|refactor   |3      |NC       |NC         |
+-----------+-------+---------+-----------+
|warning    |9      |NC       |NC         |
+-----------+-------+---------+-----------+
|error      |8      |NC       |NC         |
+-----------+-------+---------+-----------+



% errors / warnings by module
-----------------------------

+-------------------+-------+--------+---------+-----------+
|module             |error  |warning |refactor |convention |
+===================+=======+========+=========+===========+
|navix.entities     |100.00 |22.22   |100.00   |62.96      |
+-------------------+-------+--------+---------+-----------+
|navix.observations |0.00   |77.78   |0.00     |14.81      |
+-------------------+-------+--------+---------+-----------+
|tests.issue_95     |0.00   |0.00    |0.00     |18.52      |
+-------------------+-------+--------+---------+-----------+
|navix._version     |0.00   |0.00    |0.00     |3.70       |
+-------------------+-------+--------+---------+-----------+



Messages
--------

+---------------------------+------------+
|message id                 |occurrences |
+===========================+============+
|missing-function-docstring |14          |
+---------------------------+------------+
|no-member                  |8           |
+---------------------------+------------+
|line-too-long              |7           |
+---------------------------+------------+
|unused-import              |5           |
+---------------------------+------------+
|missing-module-docstring   |4           |
+---------------------------+------------+
|too-few-public-methods     |3           |
+---------------------------+------------+
|redefined-builtin          |2           |
+---------------------------+------------+
|invalid-name               |2           |
+---------------------------+------------+
|unused-argument            |1           |
+---------------------------+------------+
|global-statement           |1           |
+---------------------------+------------+




-----------------------------------
Your code has been rated at 7.38/10

@epignatelli epignatelli requested a review from Copilot August 15, 2025 15:42
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the symbolic state representation of Door objects to correctly encode their open/locked status as integers (0 for open, 1 for closed unlocked, 2 for closed locked). The implementation adds a symbolic_state property to all entities and updates the observation system to use this new property instead of the previous hardcoded logic.

  • Introduces a symbolic_state property to the base Entity class and implements it for all entity types
  • Replaces hardcoded state calculation in the observation system with the new property-based approach
  • Adds comprehensive tests to verify the correct symbolic state encoding for different door configurations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/issue_95.py Adds test cases verifying correct symbolic state values for all door state combinations
navix/observations.py Simplifies state layer calculation by using the new symbolic_state property
navix/entities.py Implements symbolic_state property for all entities with Door having the complex state logic
navix/_version.py Bumps version from 0.7.2 to 0.7.3

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@epignatelli epignatelli merged commit fe7f3ac into main Aug 15, 2025
7 checks passed
@epignatelli epignatelli deleted the i95 branch August 15, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Possible bug in symbolic observations of openable entities
1 participant