Repository navigation
[Kotlin] Replace JetBrains boilerplate in bedrock .gitignore - #8213
Conversation
kotlin/services/bedrock/.gitignore was copied verbatim from the upstream JetBrains Kotlin compiler repo and contains patterns irrelevant to this examples repo (jps-plugin, kotlin-native, js.translator, etc.). Among them is the root-anchored pattern `/local`. The WRITEME snippet scanner (aws-doc-sdk-examples-tools walk_with_gitignore) matches gitignore specs against absolute paths rather than repo-root-relative paths, so a checkout under a path beginning with `/local` (e.g. /local/home/<user>/...) causes `kotlin/services/bedrock/src` to be excluded from the walk. Every snippet beneath src/ then reports as "missing", e.g.: DocGen Error: In bedrock_metadata.yaml at Kotlin:1, missing snippet bedrock.kotlin.list_foundation_models.main Replace the file with the standard Gradle/IDE .gitignore already used by sibling services (ecr, location), preserving genuine build-artifact ignores (build/, .gradle, .idea/*, out/, .DS_Store) while removing the spurious root-anchored patterns. Verified: with the fix, the snippet scanner yields ListFoundationModels.kt and `writeme.py --check` passes repo-wide, including from a /local checkout. The underlying absolute-path handling bug in aws-doc-sdk-examples-tools is tracked separately.
There was a problem hiding this comment.
🤖 AI Code Example Review
This PR correctly replaces a JetBrains compiler .gitignore with a standard Gradle/IDE one, fixing a real snippet-scanner regression caused by the spurious /local root-anchored pattern. The change is focused, well-motivated, and safe to merge.
Detailed Review
-
[nit] Both the old and new files are missing a trailing newline (
\ No newline at end of fileappears in both hunks). Most editors and linters expect a newline at the end of a text file; adding one on the final line (### Mac OS ###\n.DS_Store\n) keeps the file POSIX-compliant and avoids noisy diffs in the future. -
[nit] The new
.gitignorenegates!gradle/wrapper/gradle-wrapper.jar(line 4 of the new file), but this pattern is only meaningful if*.jaris ignored somewhere earlier in the file. Since no*.jarrule precedes it in the new file, the negation is a no-op. Sibling services (ecr, location) may carry the same pattern; it is harmless but slightly misleading. -
[nit] The
Eclipse,NetBeans, andVS Codesections (### Eclipse ###,### NetBeans ###,### VS Code ###) are not present in the sibling service.gitignorefiles the PR description references (ecr, location). Including them is not harmful, but slightly diverges from the stated goal of matching those siblings exactly. Consider trimming to the minimal common set for consistency across services. -
[policy] No automated tests are included, which is expected — this is a purely infrastructural (
.gitignore) change with no runnable code to test. The PR description provides manual verification steps (writeme.py --check) which is appropriate for this type of change. -
[nit] The PR description mentions the root cause in
aws-doc-sdk-examples-tools(walk_with_gitignorematching absolute paths) is tracked separately. It would be helpful to add a brief comment (e.g., in a commit message or PR body link) referencing the upstream issue ticket so future readers understand why this workaround exists, but this is not a code defect. -
[nit]
.gradle(no trailing slash) on line 1 of the new file ignores both a.gradlefile and a.gradle/directory; the original used.gradle/(directory only). Either form works for standard Gradle usage, but.gradle/is the more precise pattern since.gradleis always a directory. This is consistent with the comparable sibling examples, so verify against them.
Overall the PR is a clean, targeted fix with a clear explanation. The issues noted are all minor style or completeness nits.
Reviewed at commit cc4503777d56f539e1b9df08720593e0fcfaa012. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
|
The underlying tool fix referenced in the description is now up: awsdocs/aws-doc-sdk-examples-tools#210 — it makes |
Address review nit: the file was missing a final newline after `.DS_Store`. Adding one keeps the file POSIX-compliant and avoids `\ No newline at end of file` noise in future diffs.
There was a problem hiding this comment.
🤖 AI Code Example Review
The PR successfully replaces the JetBrains compiler boilerplate .gitignore with a standard Gradle/IDE one, removing the problematic /local root-anchored pattern. All previously identified blocking issues are resolved; only minor nits remain.
Detailed Review
-
[nit] The prior finding about the missing trailing newline has been addressed — the new file ends with
.DS_Storefollowed by a newline (no\ No newline at end of filemarker in the diff). This item is resolved. -
[nit] The prior finding about
!gradle/wrapper/gradle-wrapper.jarbeing a no-op (no preceding*.jarrule) is still present at line 3 of the new file. There is no*.jarignore rule earlier in the file, so the negation remains a no-op. This is harmless but misleading; consider removing it unless a*.jarrule is intended to be added. -
[nit] The new file uses
.gradle(no trailing slash, line 1) rather than.gradle/(directory only). The previous review flagged this; it is still present. Since.gradleis always a directory in practice,.gradle/is more precise and matches what sibling services use. This is a cosmetic nit. -
[nit] The
Eclipse,NetBeans, andVS Codesections are included but are absent from the sibling service.gitignorefiles (kotlin/services/ecr,kotlin/services/location) that the PR description cites as the target template. This diverges slightly from the stated goal of matching those siblings. The patterns are harmless but add unnecessary noise; trimming to the minimal common set would be cleaner. -
[policy] No automated tests are included, which is expected for a pure infrastructure (
.gitignore) change. Manual verification steps described in the PR description (writeme.py --check) are appropriate. -
[nit] The
!**/src/main/**/build/and!**/src/test/**/build/negations (lines 4-5) are more granular than the original!**/src/**/buildand!**/test/**/buildpatterns. This is a minor behavioral difference — the new patterns only un-ignorebuild/undersrc/main/andsrc/test/, while the originals also coveredsrc/integrationTest/or similar. This is unlikely to matter in practice but worth noting. -
Overall, the core fix is correct and well-targeted:
/localand all other JetBrains compiler-specific patterns are removed. The snippet scanner regression is resolved. The remaining issues are all minor nits with no impact on correctness or security.
Reviewed at commit 48e12cc9b081339eebde9b6af585e286840b363e. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
There was a problem hiding this comment.
🤖 AI Code Example Review
The PR successfully replaces the JetBrains boilerplate .gitignore with a standard Gradle/IDE one, removing the problematic /local root-anchored pattern. All previous blocking issues are resolved; only minor nits remain from the prior reviews, and no new issues are introduced.
Detailed Review
-
[nit] Prior item (trailing newline) — ADDRESSED. The new file ends with
.DS_Storefollowed by a newline, so this is resolved. -
[nit] Prior item (
!gradle/wrapper/gradle-wrapper.jarno-op) — still present. Line 3 of the new file negatesgradle/wrapper/gradle-wrapper.jar, but no*.jarignore rule precedes it in this file. The negation is therefore a no-op. It is harmless but misleading. Consider either adding a*.jarrule before it or removing the negation if it is not needed. -
[nit] Prior item (
.gradlevs.gradle/) — still present. Line 1 uses.gradle(matches both a file and a directory named.gradle) rather than.gradle/(directory only). Since.gradleis always a directory in Gradle projects,.gradle/is more precise. This is a cosmetic nit. -
[nit] Prior item (Eclipse/NetBeans/VS Code sections) — still present. The
### Eclipse ###,### NetBeans ###, and### VS Code ###sections are included but absent from the sibling service.gitignorefiles (kotlin/services/ecr,kotlin/services/location) cited as the template. These patterns are harmless but add noise and diverge from the stated goal of matching those siblings. Trimming to the minimal common set would be cleaner. -
[nit] Prior item (
!**/src/main/**/build/vs!**/src/**/build) — still present. The new file uses!**/src/main/**/build/and!**/src/test/**/build/(lines 4–5), which are more restrictive than the original!**/src/**/buildand!**/test/**/buildpatterns. For a standard single-module Gradle project this is fine, but it would misssrc/integrationTest/or other non-standard source sets. This is a minor behavioral difference unlikely to matter in practice. -
[policy] No automated tests are included, which is expected for a pure infrastructure (
.gitignore) change. Manual verification steps in the PR description (writeme.py --check) are appropriate. -
[nit] The
/dist/entry under### NetBeans ###could theoretically conflict with legitimatedist/output directories in a Kotlin/Gradle project (though none exist in this service today). This is a low-risk observation. -
Overall, the core fix is correct and well-motivated: the
/localpattern is removed, the file now matches the standard Gradle/IDE template, and the snippet scanner regression is resolved.
Reviewed at commit 12002acf7e2d34b622416937d1de3f1e0bcca781. This review was generated automatically using Amazon Bedrock. It compares your changes against existing examples and coding guidelines. Findings are labeled by severity (blocking / nit / policy) and reflect only the commit above. Please use your judgment — this is advisory, not authoritative.
Problem
kotlin/services/bedrock/.gitignorewas copied verbatim from the upstream JetBrains Kotlin compiler repository. It contains many patterns irrelevant to this examples repo (/jps-plugin/testData/kannotator,/js/js.translator/...,/kotlin-native/dist,/confluence/target,kotlin-ide/, etc.).Among them is the root-anchored pattern
/local. The WRITEME snippet scanner (aws-doc-sdk-examples-toolswalk_with_gitignore) matches.gitignorespecs against absolute paths rather than repo-root-relative paths. As a result, when the repo is checked out under a path that begins with/local(e.g./local/home/<user>/aws-doc-sdk-examples, the default on many internal Cloud Desktops), the pattern/localmatches andkotlin/services/bedrock/srcis excluded from the file walk.Every snippet tag beneath
src/is then reported as missing — persistently, on every run, regardless of the author's actual change:The snippet is correctly tagged (
ListFoundationModels.ktL24/L43) and correctly referenced in metadata — the file was simply never scanned.Fix
Replace
kotlin/services/bedrock/.gitignorewith the standard Gradle/IDE.gitignorealready used by sibling services (kotlin/services/ecr,kotlin/services/location). This preserves the genuine build-artifact ignores (build/,.gradle,.idea/*,out/,.DS_Store) while removing the spurious root-anchored patterns.Verification
ListFoundationModels.kteven from a/local/...checkout.python3 .tools/readmes/writeme.py --languages Kotlin:1 --services bedrock --check --diff→WRITEME Run completed.(no missing-snippet error).writeme.py --checkpasses with noDocGen Error/missing snippetlines./home/runner/work/...) never matched/local— this only un-breaks local runs.Note
The underlying absolute-path handling bug in
aws-doc-sdk-examples-toolswalk_with_gitignore(matching absolute instead of repo-root-relative paths) is tracked separately with the SDK Code Examples team. This PR removes the specific pattern collision in this repo; the tool fix would prevent the whole class of issue.