Repository navigation
fix(harness): answer the framework comments on the subfolder PR - #248
Conversation
- Count .js, .jsx, .mjs, .cjs, .mts and .cts files as other source, so a Python folder beside them reads unknown, not none. Test and example folders still don't count. - Answer unknown on any blocker before the chat-model rule, so a chat model names LangChain only when nothing unseen could build the agent. - Scan a repository-origin process in the source, the same base the runtime builds it from; bundle-origin processes stay in the bundle. TH-8805 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
| if process.name == control_service: | ||
| folder = bundle_dir / process.working_directory | ||
| # The same base the runtime builds the process from. | ||
| base = bundle_dir if process.source_origin == "bundle" else source |
There was a problem hiding this comment.
This is now the same rule as build_process_trees in process_runtime.py (context.bundle_dir if process.source_origin == "bundle" else source_root). The comment above it exists because the two copies have to stay in step, and nothing enforces that. If a third origin is added, or the rule changes in the runtime, this copy will drift without a failing test.
Optional, since two copies is still within the rule of three: a small method on SourceProcess, for example def root(self, *, source: Path, bundle_dir: Path) -> Path, would let both call sites use one rule, and the comment could go.
There was a problem hiding this comment.
Agreed that the two copies can drift. I'd do this as a follow-up together with the typing comment: the method needs the tests' SimpleNamespace processes replaced by real SourceProcess models, which is that change. I'm leaving this thread open until that's settled.
| @@ -1004,7 +1017,9 @@ def framework_folders_for( | |||
| elif control_service: | |||
| for process in manifest.processes: | |||
There was a problem hiding this comment.
Not caused by this PR, but it now depends on it: framework_folders_for takes manifest: Any (and job: Any), so process.source_origin and process.working_directory are read with no type to check them against. A typo or a renamed field would only show up at runtime.
The manifest is an EnvironmentBundleV2, so typing the parameter as that would let a type checker see these reads. The tests pass SimpleNamespace fakes, so they would need the real model or a cast. Fine as a follow-up.
There was a problem hiding this comment.
Agreed. I'd do this as a follow-up, together with the shared SourceProcess method from the other comment, since both need the tests' fakes replaced by the real model. No change in this PR. I'm leaving the thread open until that's settled.
- The chat-model-with-a-blocker test repeated test_blockers_stop_none, which puts a chat model beside every blocker; its check that the chat model is read as a model moves there. - The JavaScript test keeps only the test and example folder rows; the .js and .mjs rows repeat BLOCKER_CASES. - The standalone repository-process test goes; the folder-order row and the end-to-end hosted test cover the rule. TH-8805 Signed-off-by: khushalsonawat <khushalsonawat@gmail.com>
7d8ad86
into
feat/TH-8804-source-subfolder
Stacked on #225 (TH-8804). This PR's base is
feat/TH-8804-source-subfolder, so its diff shows only these fixes. Two commits: the fixes, then the repeated tests removed at review.Summary
This answers the review's three code comments on
src/fi/alk/harness/framework_detection.py, which reached #225 from TH-8805 (#229). Each comment was reproduced at3e4e3ec5before it was fixed..js,.jsx,.mjsand.cjsnow count, as do.mtsand.cts, like.ts. A Python folder beside them readsunknowninstead ofnone. Files under test, example and similar folders still don't count, and a named framework still wins. File names are matched case-sensitively, as before.langchainonly when nothing the check couldn't read might be building the agent. Before, a folder with a chat model and, for example, an unread file beside it readlangchain. It now readsunknown.framework_folders_fortakes the folder's base fromsource_origin, the same base the runtime builds the process from (process_runtime.py). Bundle-origin processes stay in the bundle. Every process the authoring step writes is bundle-origin, so only hand-written manifests change folder.Ticket: TH-8805.
Known limits
unknownwhenever anything blocks. Triggers include test or eval files that import a framework, the app's ownagentspackage, and JavaScript or TypeScript outside test and example folders. That includes config and built files such astailwind.config.js,static/js/andweb/dist/. AStateGraphapp still readslanggraph. This is the rule the review asked for. Narrowing it is possible later..JSand.TSin upper case aren't matched, as before.Verification
tests/harness/test_framework_detection.py: 262 passed.tests/harness/test_hosted_entrypoint.py: 136 passed.tests/harness/test_scenario_source_provision_agent.py: 23 passed. All on Python 3.12.14, each file in its own run, on9c187fe2plus this commit. On Python 3.12.3, the sandbox's version, the detector and scenario-source files give 262 + 23.langchaintounknown, with a chat model and one blocker. No answer changes in the 101 design-review fixtures, the 19examples/frameworksor the 2 harness fixtures..jsxundertests/,.mjsunderexamples/), one test comment, the description text, and the removal of the repeated tests asked for in this PR's review.ruff checkpasses on the three files.🤖 Generated with Claude Code