Skip to content

Feat/disable entrypoint for base context 2 #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 18, 2025

Conversation

rycont
Copy link
Owner

@rycont rycont commented Jul 18, 2025

This pull request introduces a new feature to handle a "base context" in the execution flow, updates the version across multiple packages, and adds a corresponding test to ensure the feature works as expected. The most important changes include the addition of the BASE_CONTEXT_SYMBOL to the YaksokSession class, modifications to the execution logic in the Block class, and updates to the test suite to verify the new behavior.

New Feature: Base Context Handling

  • core/session/session.ts: Introduced a private #BASE_CONTEXT_SYMBOL in the YaksokSession class, made accessible via a public getter, to identify the base context. This symbol is used to differentiate the base context from the main context during execution.
  • core/node/block.ts: Updated the execution logic in the Block class to skip execution delays and reporting for the base context by adding a new isBaseContext condition.

Test Suite Enhancements

  • test/execution-delay.test.ts: Added a new test, "Execution Delay with Base Context," to verify that execution delays are correctly applied to the main context but not to the base context. This ensures the proper functioning of the new base context feature.

Version Updates

  • Updated the version from 2.2.1 to 2.2.2 in core/deno.json, deno.json, monaco-language-provider/deno.json, and quickjs/deno.json to reflect the new feature release. [1] [2] [3] [4]

google-labs-jules bot and others added 4 commits July 18, 2025 15:35
Base Context를 실행할 때도 executionDelay와 runningCodes가 보고되는 문제를 해결했습니다.

- `YaksokSession`의 `BASE_CONTEXT_SYMBOL`을 public getter로 변경하고, `Block` 노드에서 현재 실행 중인 코드가 Base Context인지 확인하여 `executionDelay`와 `runningCode` 보고를 건너뛰도록 수정했습니다.
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @rycont, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily introduces a new 'base context' feature, allowing certain code executions to bypass standard delays and reporting. This is crucial for optimizing performance in specific scenarios where such overhead is undesirable. Alongside this core functionality, the PR includes comprehensive test coverage for the new feature and updates various package versions to ensure compatibility and leverage the latest dependencies.

Highlights

  • Feature: Base Context Handling: Introduced a mechanism to define and identify a 'base context' within the YaksokSession class using a new BASE_CONTEXT_SYMBOL.
  • Execution Logic Modification: Updated the Block class's execution logic to skip applying execution delays and reporting for code running within the identified base context, optimizing performance for background or foundational operations.
  • Test Coverage: Added a new test case (test/execution-delay.test.ts) to specifically verify that execution delays are correctly bypassed for the base context while still applying to the main execution flow.
  • Version Bumps: Incremented the project version from 2.2.1 to 2.2.2 across core, monaco-language-provider, and quickjs packages, along with updating the main deno.json and deno.lock files to reflect new dependency versions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new feature to handle a "base context" in the execution flow, which is a great addition for managing setup code. The implementation is solid, and the new test case effectively validates the desired behavior. I've provided a few suggestions to enhance code maintainability and style consistency by refactoring a repeated condition and aligning a getter's name with common TypeScript conventions.

Comment on lines +25 to +27
const isBaseContext =
scope.codeFile?.fileName ===
scope.codeFile?.session?.BASE_CONTEXT_SYMBOL

Choose a reason for hiding this comment

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

medium

To align with common TypeScript style conventions (like the Google TypeScript Style Guide), public properties and getters should use camelCase. This should be updated to baseContextSymbol to match the suggested change in YaksokSession.

Suggested change
const isBaseContext =
scope.codeFile?.fileName ===
scope.codeFile?.session?.BASE_CONTEXT_SYMBOL
const isBaseContext =
scope.codeFile?.fileName ===
scope.codeFile?.session?.baseContextSymbol

Comment on lines +35 to 41
if (executionDelay && isMainContext && !isBaseContext) {
await new Promise((r) => setTimeout(r, executionDelay))
}

if (child.tokens.length && isMainContext) {
if (child.tokens.length && isMainContext && !isBaseContext) {
this.reportRunningCode(child, scope)
}

Choose a reason for hiding this comment

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

medium

The condition isMainContext && !isBaseContext is checked twice in this block. To improve readability and reduce redundancy, you can group the logic under a single conditional check.

Suggested change
if (executionDelay && isMainContext && !isBaseContext) {
await new Promise((r) => setTimeout(r, executionDelay))
}
if (child.tokens.length && isMainContext) {
if (child.tokens.length && isMainContext && !isBaseContext) {
this.reportRunningCode(child, scope)
}
if (isMainContext && !isBaseContext) {
if (executionDelay) {
await new Promise((r) => setTimeout(r, executionDelay))
}
if (child.tokens.length) {
this.reportRunningCode(child, scope)
}
}

Comment on lines +54 to +57
readonly #BASE_CONTEXT_SYMBOL = Symbol('baseContext')
public get BASE_CONTEXT_SYMBOL(): symbol {
return this.#BASE_CONTEXT_SYMBOL
}

Choose a reason for hiding this comment

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

medium

Using a private field with a public getter is a great pattern for encapsulation. However, to align with common TypeScript style conventions (e.g., Google's style guide), public properties and getters should use camelCase. The name BASE_CONTEXT_SYMBOL uses SCREAMING_SNAKE_CASE, which is generally reserved for compile-time constants. Renaming this to baseContextSymbol would improve code consistency. Remember to update its usage in core/node/block.ts as well.

Suggested change
readonly #BASE_CONTEXT_SYMBOL = Symbol('baseContext')
public get BASE_CONTEXT_SYMBOL(): symbol {
return this.#BASE_CONTEXT_SYMBOL
}
readonly #baseContextSymbol = Symbol('baseContext')
public get baseContextSymbol(): symbol {
return this.#baseContextSymbol
}

@rycont rycont force-pushed the feat/disable-entrypoint-for-base-context-2 branch from f354911 to 0ebc481 Compare July 18, 2025 15:50
Copy link

Deploying dalbit-yaksok with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0ebc481
Status: ✅  Deploy successful!
Preview URL: https://22f839c3.yaksok-ts.pages.dev
Branch Preview URL: https://feat-disable-entrypoint-for.yaksok-ts.pages.dev

View logs

@rycont
Copy link
Owner Author

rycont commented Jul 18, 2025

이번 업데이트의 핵심은 'Base Context'에서 실행되는 코드는 executionDelay의 영향을 받지 않도록 개선하고, 관련 테스트
코드를 추가한 것입니다. 더불어 프로젝트의 전체 버전이 2.2.1에서 2.2.2로 올라갔습니다.

각 파일별 변경 사항은 다음과 같습니다.

  1. executionDelay 동작 방식 개선 (core/node/block.ts)
  • 무엇이 바뀌었나요?

    • executionDelay는 코드 실행을 시각적으로 보여주거나 디버깅을 쉽게 하기 위해 각 코드 라인 실행 사이에 지연 시간을 주는
      기능입니다.
    • 그런데 이 기능이 Base Context(미리 정의된 함수나 변수들이 모여있는 기본 환경)에 있는 코드에까지 적용되어 불필요한
      성능 저하를 일으킬 수 있었습니다.
    • 이번 변경으로 코드가 Base Context에서 실행될 때는 executionDelay가 적용되지 않도록 수정되었습니다.
  • 왜 바뀌었나요?

    • 사용자가 작성한 코드의 실행 흐름을 천천히 보고 싶을 때 executionDelay를 사용하는데, 이때 내부적으로 사용되는 기본
      함수들까지 느려질 필요는 없습니다.
    • 이 개선을 통해 사용자의 코드에만 지연 실행이 적용되어, 디버깅 경험은 유지하면서도 내부 라이브러리 함수의 성능은
      그대로 유지할 수 있게 되었습니다.
  1. 새로운 테스트 추가 (test/execution-delay.test.ts)
  • 무엇이 바뀌었나요?
    • 위 executionDelay 개선 사항이 올바르게 작동하는지 검증하기 위한 새로운 테스트 케이스(Execution Delay with Base
      Context)가 추가되었습니다.
  • 어떻게 동작하나요?
    • Base Context에 특정 함수를 미리 정의해두고, 메인 코드에서 그 함수를 호출합니다.
    • executionDelay를 설정했을 때, Base Context에 있던 함수는 지연 없이 빠르게 실행되고, 메인 코드만 설정된 시간만큼
      느리게 실행되는지를 확인하여 의도대로 잘 수정되었는지 검증합니다.

요약하자면, 디버깅 편의 기능(executionDelay)이 핵심 기능의 성능을 저해하지 않도록 개선하고, 코드의 안정성을 높인
업데이트라고 할 수 있습니다.

@rycont rycont merged commit d048934 into main Jul 18, 2025
3 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.

1 participant