Skip to content

Add current context support with push/pop mechanism#7

Merged
JohnAmadis merged 8 commits into
mainfrom
copilot/add-current-context-support
Nov 28, 2025
Merged

Add current context support with push/pop mechanism#7
JohnAmadis merged 8 commits into
mainfrom
copilot/add-current-context-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 28, 2025

  • Understand the issue: add support for current context with push/pop mechanism and rename global context to root_context
  • Explore the repository and understand the codebase
  • Build and run existing tests
  • Rename g_default_context to g_root_context and update API names:
    • Add dmenv_set_root_context API
    • Add dmenv_get_root_context API
    • Removed deprecated dmenv_set_as_default and dmenv_get_default functions
  • Add new context stack functionality:
    • Add internal context stack structure (fixed size of 16 entries)
    • Add dmenv_push_context API
    • Add dmenv_pop_context API
    • Add dmenv_get_current_context API to get the current context (top of stack or root)
    • Update Dmod_SetEnv and Dmod_GetEnv to use current context
  • Update tests with new API
  • Add tests for push/pop functionality (5 tests)
  • Update README with new API documentation
  • Fix CI build issue with memory_analysis.cmake
  • Fix CI coverage issue by skipping custom linker script and adding stub symbols
  • Run code review (addressed nitpicks)
  • Run CodeQL security check (no issues)
Original prompt

This section details on the original issue you should resolve

<issue_title>Dodać wsparcie dla current context</issue_title>
<issue_description>Aktualnie mamy możliwość ustawienia globalnego contextu - trzeba go przemianować na root_context, a dodatkowo dać możliwość zmiany 'aktualnego contextu' na zasadzie push i pop. Czyli - jak użytkownik zawoła push_context to jako current ustawiamy nowy, a jak zrobi pop_context to przywracamy wcześniejszy (można poszukać od root context)</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 28, 2025 21:01
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for current context management Add current context support with push/pop mechanism Nov 28, 2025
Copilot AI requested a review from JohnAmadis November 28, 2025 21:09
Copy link
Copy Markdown
Contributor

@JohnAmadis JohnAmadis left a comment

Choose a reason for hiding this comment

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

@copilot małe poprawki

Comment thread include/dmenv.h Outdated
* @param ctx Context to set as default
* @deprecated Use dmenv_set_root_context instead
*/
DMOD_BUILTIN_API(dmenv, 1.0, void, _set_as_default, (dmenv_ctx_t ctx));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Te funkcje deprecated możesz usunąć od razu, ja poprawie odwołania w drugim repo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed dmenv_set_as_default and dmenv_get_default functions and updated tests in commit 31eb055.

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
@JohnAmadis
Copy link
Copy Markdown
Contributor

@copilot readme nie zaktualizowales

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot readme nie zaktualizowales

Updated README with new context stack API documentation in commit d8be37a. Added:

  • New features: context stack and root context
  • Context stack usage example
  • API documentation for dmenv_set_root_context, dmenv_get_root_context, dmenv_push_context, dmenv_pop_context, and dmenv_get_current_context
  • Updated test suite description

@JohnAmadis JohnAmadis marked this pull request as ready for review November 28, 2025 21:28
@JohnAmadis
Copy link
Copy Markdown
Contributor

@copilot jakiś problem z kompilacja jest na CI

CMake Error: Not a file: /memory_analysis.cmake

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot jakiś problem z kompilacja jest na CI

CMake Error: Not a file: /memory_analysis.cmake

Fixed in commit f29b3b4. The create_library_makefile function is now skipped in CI environments to avoid the memory_analysis.cmake path resolution issue when DMOD is fetched as a dependency.

@JohnAmadis
Copy link
Copy Markdown
Contributor

@copilot jeszcze to:
lcov: ERROR: no valid records found in tracefile coverage.info

Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot jeszcze to:
lcov: ERROR: no valid records found in tracefile coverage.info

Fixed in commit a3b53ba. The coverage job was failing because the custom linker script (for embedded targets) prevents .gcda coverage files from being generated. The fix:

  1. Skip the custom linker script when ENABLE_COVERAGE=ON
  2. Add coverage_stubs.c with stub symbols (__dmod_inputs_start, etc.) that are normally provided by the linker script

@JohnAmadis JohnAmadis merged commit 5c83e93 into main Nov 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dodać wsparcie dla current context

2 participants