Skip to content

Conversation

@drdavella
Copy link
Member

@drdavella drdavella commented Mar 3, 2025

Overview

Introduces new fix-oriented CodeTF data model as implementation for v3

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 3, 2025

@drdavella drdavella requested a review from nahsra March 3, 2025 18:26

class AIMetadata(BaseModel):
provider: Optional[str] = None
models: Optional[list[str]] = None
Copy link
Member Author

Choose a reason for hiding this comment

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

Multiple models may be involved in fix generation

fixStatus: FixStatus
changeSets: list[ChangeSet]
fixMetadata: Optional[FixMetadata] = None
fixQuality: Optional[FixQuality] = None
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix quality evaluation belongs to the entire result, not just to a single file/diff.

class FixResult(BaseModel):
"""Result corresponding to a single finding"""

finding: Finding
Copy link
Member Author

Choose a reason for hiding this comment

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

There is now a strict 1:1 mapping between finding and fix.

fixMetadata: Optional[FixMetadata] = None
fixQuality: Optional[FixQuality] = None
# A description of the reasoning process that led to the fix
reasoningSteps: Optional[list[str]] = None
Copy link
Member Author

Choose a reason for hiding this comment

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

Potentially each entry here should be something richer than a flat string: we might want to incorporate steps that represent user input/feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

I could quibble that we have no idea what form that would take, and whether we should design for anything beyond a str now... but if you have short term thoughts that this is a promising data type, I'm okay with it.


class CodeTF(CodeTFWriter, BaseModel):
run: Run
results: list[FixResult]
Copy link
Member Author

Choose a reason for hiding this comment

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

My expectation is that each finding in the input will have a corresponding result. I don't believe that's enforceable in the spec, and it probably should not be since we want to allow for the possibility of streaming subsets of results.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe that's enforceable in the spec, and it probably should not be since we want to allow for the possibility of streaming subsets of results.

I'm not sure why these requirements are at odds. Aren't we only giving it 1 input as well? We had discussed as an input a single SARIF, and a single result ID (or something.) In this case, we'd expect 0 or 1 FixResult.

Copy link
Member Author

Choose a reason for hiding this comment

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

Aren't we only giving it 1 input as well? We had discussed as an input a single SARIF, and a single result ID (or something.)

As a practical matter I'm still not convinced that's the best approach although we can work towards that setup. In any case I don't think we want to preclude the possibility of batch processing.

In this case, we'd expect 0 or 1 FixResult.

I would argue that the absence of any FixResult should be an exceptional condition. We should potentially consider making FixResult required. The fact that this would encode fix status means we should return a failure status if processing is failed or skipped


class PackageAction(BaseModel):
action: Action
result: PackageResult
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I ever fully understood the rationale for the result field: it might be worth discussing whether it's still necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think associating a change to a dependency can allow downstream users to tell users add a dependency (like if it failed), or that this increases reliance on a dependency, etc.

@drdavella
Copy link
Member Author

I am merging this as it is still currently in draft status and does not affect any production codepaths. However making it available will be useful for prototyping new features and functionality.

@drdavella drdavella added this pull request to the merge queue Mar 6, 2025
Merged via the queue into main with commit 160ada0 Mar 6, 2025
15 checks passed
@drdavella drdavella deleted the codetf-v3-working-draft branch March 6, 2025 15:33
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.

3 participants