## Task list - [x] Define the data model to store code references in the database. Recommendation: ``` FeatureFlagCodeReferencesScan: project: Project created_at: datetime repository_url: str revision: str code_references: - feature_name: <str> file_path: <str> line_number: <int> - ... ... ``` - [x] Implement view to submit code references (from CI). ```yaml # /api/v1/projects/{project_pk}/feature-code-references/ repository_url: https://github.com/Flagsmith/flagsmith revision: <commit_hash> code_references: - feature_name: segment_cloning file_path: api/something/foo/bar.py line_number: 32 - feature_name: <str> file_path: <str> line_number: <int> - ... ``` - [x] Fetch code references for **one** feature flag (for the feature detail UI). ```yaml # /api/v1/projects/{project_pk}/features/{feature_pk}/code-references/ - repository_url: <str> last_successful_repository_scanned_at: <timestamp> last_feature_found_at: <timestamp> code_references: - file_path: <str> line_number: <int> permalink: <str> # For now only GitHub vcs_revision: <str> - ... - ``` - [x] Add code reference **counts** to the feature list endpoint (for the list UI). ```yaml # /api/v1/projects/{project_pk}/features/ ... results: - id: <int> name: <str> ... code_references_counts: - repository_url: <str> count: <int> last_successful_repository_scanned_at: <timestamp> last_feature_found_at: <timestamp> - ... - ... ``` - [x] POST to the new endpoint from the CI job (#5731). > [!NOTE] > - URLs and schemas above were aligned between @Zaimwa9 and @emyller in effort to keep things simple though flexible for extension after the PoC. > - JSON is suggested as to avoid flooding the database with a multi-table spamming of tuples. > - We might need indexes to help filtering in JSON blobs by "feature_name", "created_at".
Task list
Recommendation:
Note