Skip to content

copilot-core: Tests of Copilot.Core.Type.Array do not achieve full coverage for main coverage categories #767

Closed

Description

@ivanperez-keera

Description

The module copilot-core:Copilot.Core.Type.Array achieves less than full coverage in the two of the three main categories used by hpc, namely "Top Level Definitions" and "Expressions". For the former, only 4 out of 6 definitions are covered and, for the latter, only 47 out of 48.

To make Copilot ready for use in future missions, we want to achieve maximum coverage possible.

Type

  • Management: Increase test coverage.

Additional context

None.

Requester

  • Ivan Perez.

Method to check presence of bug

Not applicable (not a bug).

Expected result

When generating the HPC markup report for copilot-core, the tool reports full coverage associated to copilot-core:Copilot.Core.Type.Array in all three main coverage categories.

Desired result

When generating the HPC markup report for copilot-core, the tool reports full coverage associated to copilot-core:Copilot.Core.Type.Array in all three main coverage categories.

Proposed solution

Add tests to copilot-core to increase coverage of copilot-core:Copilot.Core.Type.Array.

Further notes

Due to limitations of hpc, full coverage may require changing the code for force evaluation of values not needed at runtime (e.g., Proxy).

We leave boolean guard coverage out of the scope of this ticket, because HPC reports less than full coverage when guards with a final condition that always succeeds. This is a known limitation of hpc and the only reason why the module copilot-core:Copilot.Core.Type.Array achieves less than full boolean guard coverage.

Activity

  1. added
    CR:Type:ManagementAdmin only: Change request for conformance with policies or procedures
    CR:Status:InitiatedAdmin only: Change request that has been initiated
    on Oct 12, 2026
  2. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Change Manager: Confirmed that the issue exists.

  3. added
    CR:Status:ConfirmedAdmin only: Change request that has been acknowledged by the change manager
    and removed
    CR:Status:InitiatedAdmin only: Change request that has been initiated
    on Oct 12, 2026
  4. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Technical Lead: Confirmed that the issue should be addressed.

  5. added
    CR:Status:AcceptedAdmin only: Change request accepted by technical lead
    and removed
    CR:Status:ConfirmedAdmin only: Change request that has been acknowledged by the change manager
    on Oct 12, 2026
  6. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Technical Lead: Issue scheduled for fixing in Copilot 4.8.2.

    Fix assigned to: @ivanperez-keera .

  7. added
    CR:Status:ScheduledAdmin only: Change requested scheduled
    and removed
    CR:Status:AcceptedAdmin only: Change request accepted by technical lead
    on Oct 12, 2026
  8. added this to the 4.8.2 milestone on Oct 12, 2026
  9. added
    CR:Status:ImplementationAdmin only: Change request that is currently being implemented
    and removed
    CR:Status:ScheduledAdmin only: Change requested scheduled
    on Oct 12, 2026
  10. 6 remaining items

  11. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Implementor: Solution implemented, review requested.

  12. added
    CR:Status:VerificationAdmin only: Change request that is currently being verified
    and removed
    CR:Status:ImplementationAdmin only: Change request that is currently being implemented
    on Oct 12, 2026
  13. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Change Manager: Verified that:

    • Solution is implemented:
      • The code proposed compiles and passes all tests. Details:
        Build log: https://app.travis-ci.com/github/Copilot-Language/copilot/builds/278972667
      • The solution proposed produces the expected result. Details:
        The following Dockerfile tests copilot-core with coverage enabled; generates the hpc report for the specific module Copilot.Core.Type.Array, and compares the covered items from the main hpc categories to the total items to ensure full coverage, after which it prints the message "Success":
        --- Dockerfile-verify-767
        FROM ubuntu:jammy
        
        WORKDIR /root
        SHELL ["/bin/bash", "-c"]
        
        ENV DEBIAN_FRONTEND=noninteractive
        RUN apt-get update
        
        RUN apt-get install --yes \
              bc \
              curl \
              g++ \
              gcc \
              git \
              libgmp3-dev  \
              libz-dev \
              make \
              pkg-config \
              z3
        
        RUN mkdir -p $HOME/.ghcup/bin
        RUN curl https://downloads.haskell.org/~ghcup/0.1.40.0/x86_64-linux-ghcup-0.1.40.0 -o $HOME/.ghcup/bin/ghcup
        RUN chmod a+x $HOME/.ghcup/bin/ghcup
        ENV PATH=$PATH:/root/.ghcup/bin/
        ENV PATH=$PATH:/root/.cabal/bin/
        
        RUN ghcup install ghc 9.10.1
        RUN ghcup install cabal 3.2
        RUN ghcup set ghc 9.10.1
        RUN cabal user-config init
        RUN sed -i -e "s;-- \(secure.\) True;\1 False;g" /root/.cabal/config
        RUN cabal update
        
        ARG GIT_COMMIT=HEAD
        ARG NAME=copilot
        ARG REPO=https://github.com/copilot-language/copilot
        
        RUN git clone ${REPO} ${NAME}
        RUN cd ${NAME} && git checkout ${GIT_COMMIT}
        
        WORKDIR ${NAME}
        
        RUN cabal v1-sandbox init
        RUN cabal v1-install alex happy
        
        WORKDIR copilot-core
        RUN cabal v1-sandbox init --sandbox=$PWD/../.cabal-sandbox/
        
        RUN cabal v1-install --enable-tests --only-dependencies
        RUN cabal v1-configure --enable-library-coverage
        RUN cabal v1-test
        RUN VERSION="$(grep -e '^version:' copilot-core.cabal | grep -oe '[[:digit:]].*')" && \
            hpc report unit-tests.tix --include='Copilot.Core.Type.Array' $(find dist -type d -name "mix" -exec echo --hpcdir={}/copilot-core-$VERSION \;) > output
        RUN grep -e 'used' output | grep -oe '[[:digit:]]\+/' | grep -oe '[[:digit:]]\+' > covered
        RUN grep -e 'used' output | grep -oe '/[[:digit:]]\+' | grep -oe '[[:digit:]]\+' > total
        RUN [ $(wc -l < covered) -eq 4 ] && diff covered total
        RUN echo "Success"
        Command (substitute variables based on new path after merge):
        $ docker build --build-arg "REPO=https://github.com/ivanperez-keera/copilot" --build-arg "NAME=copilot" --build-arg "GIT_COMMIT=34cc90741e8b792d8f55ad7e875a3bdcffe4a122" -t copilot-verify-767 -f Dockerfile-verify-767 .
        
    • Implementation is documented. Details:
      New top-level definitions include documentation.
    • Change history is clear.
    • Commit messages are clear.
    • Changelogs are updated.
    • Examples are updated. Details:
      No updates needed; change is internal and to the tests and does not affect existing examples.
    • Author is internal or has provided signed CLA.
    • Required version bumps are evaluated. Details:
      Bump not needed; change is internal and to the tests and does not affect public API.
  14. ivanperez-keera commented on Oct 12, 2026

    @ivanperez-keera
    MemberAuthor

    Change Manager: Implementation ready to be merged.

  15. added
    CR:Status:ClosedAdmin only: Change request that has been completed
    and removed
    CR:Status:VerificationAdmin only: Change request that is currently being verified
    on Oct 12, 2026
  16. added 2 commits that reference this issue on Oct 12, 2026
    094316c
    0fa4d5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

CR:Status:ClosedAdmin only: Change request that has been completedCR:Type:ManagementAdmin only: Change request for conformance with policies or procedures

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions