Skip to content

feat(core): add context accessor functions (F-CP-06)#91

Merged
eterna2 merged 1 commit intorelease/v0.4.0from
feat/context-accessor-functions
Apr 24, 2026
Merged

feat(core): add context accessor functions (F-CP-06)#91
eterna2 merged 1 commit intorelease/v0.4.0from
feat/context-accessor-functions

Conversation

@eterna2
Copy link
Copy Markdown
Owner

@eterna2 eterna2 commented Apr 24, 2026

Summary

Closes #76

Implements the five public context accessor functions required by SPEC-v0.3.0 §2.8 F-CP-06.

Changes

libs/kest-core/python/src/kest/core/framework/context.py

  • Added get_current_user(), get_current_agent(), get_current_task()
  • Added type-safe _get_baggage_str() helper (narrows object | Nonestr | None)
  • Added type hints and docstrings to existing get_current_jwt() and get_current_passport()

libs/kest-core/python/src/kest/core/__init__.py

  • Imported and exported all 5 accessors in __all__

libs/kest-core/python/src/kest/core/framework/context_test.py

  • 10 unit tests (TDD): 2 per accessor (value present + absent)

.gitignore

  • Added drafts/ to gitignore

Test Results

  • 10 new tests: All passing
  • 170 total tests: All passing
  • 0 regressions

Spec Compliance

Function Baggage Key Spec Ref
get_current_user() kest.user F-CP-06, §8.4
get_current_agent() kest.agent F-CP-06, §8.4
get_current_task() kest.task F-CP-06, §8.4
get_current_jwt() kest.jwt F-CP-06, §8.4
get_current_passport() kest.passport F-CP-06, §8.4

@eterna2 eterna2 added enhancement New feature or request kest-core-python kest-core Python library labels Apr 24, 2026
@eterna2 eterna2 force-pushed the feat/context-accessor-functions branch 2 times, most recently from b56ab1f to 9da6f3f Compare April 24, 2026 13:13
@eterna2 eterna2 changed the base branch from main to release/v0.4.0 April 24, 2026 13:13
@eterna2 eterna2 force-pushed the feat/context-accessor-functions branch 4 times, most recently from 3b9b78a to 730c226 Compare April 24, 2026 13:25
Implement the five public context accessor functions required by
SPEC-v0.3.0 §2.8 F-CP-06:

- get_current_user()    — reads kest.user from OTel Baggage
- get_current_agent()   — reads kest.agent from OTel Baggage
- get_current_task()    — reads kest.task from OTel Baggage
- get_current_jwt()     — reads kest.jwt (existing, now typed + exported)
- get_current_passport()— reads kest.passport (existing, now typed + exported)

Changes:
- Add 3 new accessors + type-safe _get_baggage_str helper to context.py
- Add type hints and docstrings to existing 2 accessors
- Export all 5 from kest.core.__init__.py
- 10 unit tests (TDD: 2 per accessor — present + absent)
- Gitignore drafts/ directory
@eterna2 eterna2 force-pushed the feat/context-accessor-functions branch from 730c226 to a9b67e1 Compare April 24, 2026 13:28
@eterna2 eterna2 merged commit b36a5d4 into release/v0.4.0 Apr 24, 2026
4 checks passed
@eterna2 eterna2 deleted the feat/context-accessor-functions branch April 24, 2026 14:03
eterna2 added a commit that referenced this pull request Apr 25, 2026
Implement the five public context accessor functions required by
SPEC-v0.3.0 §2.8 F-CP-06:

- get_current_user()    — reads kest.user from OTel Baggage
- get_current_agent()   — reads kest.agent from OTel Baggage
- get_current_task()    — reads kest.task from OTel Baggage
- get_current_jwt()     — reads kest.jwt (existing, now typed + exported)
- get_current_passport()— reads kest.passport (existing, now typed + exported)

Changes:
- Add 3 new accessors + type-safe _get_baggage_str helper to context.py
- Add type hints and docstrings to existing 2 accessors
- Export all 5 from kest.core.__init__.py
- 10 unit tests (TDD: 2 per accessor — present + absent)
- Gitignore drafts/ directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request kest-core-python kest-core Python library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(core): add context accessor functions (get_current_user, get_current_agent, etc.)

1 participant