* feat: raise the validations up
* feat: add error enhancements to the AI Block
* fix: extract the TODO_COMMENT to the constants
* fix: move ErrorEnhancements
* fix: move TODO_COMMENT
* feat: add interview ID to the log
* feat: enhancement is used in system prompt
* fix: imports in the gen_test
* feat: add decimal support
* fix(develop): don't error when the only issue is llm errors
* fix: regex
* feat: naive fuzzy match
* feat: naive fuzzy match
* feat(prompts): add context to the prompt
* fix(prompt): improve language
* fix(error_enhancements): copy paste typos and small missed logic bugs
* Add handling of "reportPrivateImportUsage" error to error enhancements
* refactor(error_enhancements): Improve code structure and readability
- Extract common error enhancement logic into separate functions
* Fix error in error_message extraction
I had previously extracted non-generally applicable functionality to a function. This undoes that.
* Run ruff linter
* Remove typo in enhance_error function declaration.
* Fix type hint in enhance_error function declaration to allow return dictionary values to be None.
* Fix type hint in enhance_error function declaration to allow return dictionary values to be None.
* Formats code_validation.py with Ruff
* feat: first go of UploadFile
* fix: fixes to main and quietly publishing to gh for now
* fix(deploy): add note to create the repos on dev env in private
(because people were contacting us about the publicly created agpt-coder repos)
* fix(deploy): Do not log created GitHub repo URL with token
* feat(requirements, develop): Add fastapi.UploadFile as available built-in type
* fix(requirements): Allow list for authorization_roles while refining requirements
Changes:
* Avoid using corrupted env files by moving the parent dependency folder for linting out of TMP.
* Add stricter env existence check (check all the required executables: pyright prisma virtualenv-clone).
* Fix execution bug due to migrating from str -> Path.
* Fix unrelated error on code-validation.
* Add `-I` on pip install for installing linting deps to fix corrupted installations.
---------
Co-authored-by: majdyz <[email protected]>
* refactor(common, develop/validate): Use `pathlib` to clean up file writing & path processing
* refactor(deploy): Use `pathlib` to clean up file operations
To prevent frustrated tester, we should let buggy code to be generated instead of failing the project generation (if it failed on the linter) by appending a # TODO line on the code.
---------
Co-authored-by: majdyz <[email protected]>
Subprocess execution implementation (for Ruff & PyRight) is currently a blocking call. This doesn't work well with the event-loop used by the fastapi.
Scope:
Make AiBlock.validate async
Make subprocess execution async.
---------
Co-authored-by: majdyz <[email protected]>
Integrating PyRight project-based code-linting. This will allow us to detect:
* Misuse of async functions.
* Misuse of optional type and other annotated types (currently disabled)
* Wrong usage of pydantic and prisma model.
* Wrong usage of third-party library.
* Use of undeclared field
* Use of uninstalled third-party library (which will prompt LLM to add the requirement list)
Known trade-off:
Setting-up PyRight requires building a full-project (generate the Prisma model code, installing 3rd-party library, compiling the function with the object dependency) this slows down the code-validation during the code-validation step.
---------
Co-authored-by: majdyz <[email protected]>
Co-authored-by: SwiftyOS <[email protected]>
This is a large but a much needed change to allow more sophisticated static code analysis to be added.
PyRight (used by pylance) will allow us to detect:
Misuse of async functions.
Misuse of optional type and other annotated types.
Wrong usage of pydantic and prisma model.
Wrong usage of third-party library.
The overhaul is required to allow us retrying while fixing the code as a project (not only as a function) and allow us to keep adding non-LLM fixes to it so that we can avoid wasting the retry.
The scope of this PR is still a refactoring and the adding of the PyRight linter, so this PR try to keep the existing behaviour.
The enablement and more tuning on the linter will be done in the followup PR.
---------
Co-authored-by: majdyz <[email protected]>