Skip to content

[Kotlin] Replace JetBrains boilerplate in bedrock .gitignore - #8213

Merged
rlhagerm merged 3 commits into
awsdocs:mainfrom
brmur:fix/kotlin-gitignore-boilerplate
Oct 15, 2026
Merged

rlhagerm merged 3 commits into
awsdocs:mainfrom
brmur:fix/kotlin-gitignore-boilerplate

Conversation

@brmur

@brmur brmur commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

kotlin/services/bedrock/.gitignore was 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-tools walk_with_gitignore) matches .gitignore specs 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 /local matches and kotlin/services/bedrock/src is 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:

Metadata errors encountered:
    DocGen Error: In .doc_gen/metadata/bedrock_metadata.yaml at Kotlin:1, missing snippet bedrock.kotlin.list_foundation_models.main

The snippet is correctly tagged (ListFoundationModels.kt L24/L43) and correctly referenced in metadata — the file was simply never scanned.

Fix

Replace kotlin/services/bedrock/.gitignore with the standard Gradle/IDE .gitignore already 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

  • With the fix, the snippet scanner yields ListFoundationModels.kt even from a /local/... checkout.
  • python3 .tools/readmes/writeme.py --languages Kotlin:1 --services bedrock --check --diff → WRITEME Run completed. (no missing-snippet error).
  • Full repo writeme.py --check passes with no DocGen Error / missing snippet lines.
  • Does not affect GitHub Actions CI, whose runner paths (/home/runner/work/...) never matched /local — this only un-breaks local runs.

Note

The underlying absolute-path handling bug in aws-doc-sdk-examples-tools walk_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.

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 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

  1. [nit] Both the old and new files are missing a trailing newline (\ No newline at end of file appears 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.

  2. [nit] The new .gitignore negates !gradle/wrapper/gradle-wrapper.jar (line 4 of the new file), but this pattern is only meaningful if *.jar is ignored somewhere earlier in the file. Since no *.jar rule 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.

  3. [nit] The Eclipse, NetBeans, and VS Code sections (### Eclipse ###, ### NetBeans ###, ### VS Code ###) are not present in the sibling service .gitignore files 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.

  4. [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.

  5. [nit] The PR description mentions the root cause in aws-doc-sdk-examples-tools (walk_with_gitignore matching 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.

  6. [nit] .gradle (no trailing slash) on line 1 of the new file ignores both a .gradle file 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 .gradle is 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.

Comment thread kotlin/services/bedrock/.gitignore Outdated
Comment thread kotlin/services/bedrock/.gitignore
@brmur

brmur commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator Author

The underlying tool fix referenced in the description is now up: awsdocs/aws-doc-sdk-examples-tools#210 — it makes walk_with_gitignore match .gitignore specs relative to the walk root instead of the absolute checkout path, which prevents the whole class of root-anchored-pattern (/local) collisions rather than patching one .gitignore at a time. This PR remains useful as the repo-side cleanup of the stray JetBrains boilerplate.

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 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

  1. [nit] The prior finding about the missing trailing newline has been addressed — the new file ends with .DS_Store followed by a newline (no \ No newline at end of file marker in the diff). This item is resolved.

  2. [nit] The prior finding about !gradle/wrapper/gradle-wrapper.jar being a no-op (no preceding *.jar rule) is still present at line 3 of the new file. There is no *.jar ignore rule earlier in the file, so the negation remains a no-op. This is harmless but misleading; consider removing it unless a *.jar rule is intended to be added.

  3. [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 .gradle is always a directory in practice, .gradle/ is more precise and matches what sibling services use. This is a cosmetic nit.

  4. [nit] The Eclipse, NetBeans, and VS Code sections are included but are absent from the sibling service .gitignore files (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.

  5. [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.

  6. [nit] The !**/src/main/**/build/ and !**/src/test/**/build/ negations (lines 4-5) are more granular than the original !**/src/**/build and !**/test/**/build patterns. This is a minor behavioral difference — the new patterns only un-ignore build/ under src/main/ and src/test/, while the originals also covered src/integrationTest/ or similar. This is unlikely to matter in practice but worth noting.

  7. Overall, the core fix is correct and well-targeted: /local and 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.

Comment thread kotlin/services/bedrock/.gitignore
Comment thread kotlin/services/bedrock/.gitignore
@brmur brmur added the Task A general update to the code base for language clarification, missing actions, tests, etc. label Oct 15, 2026
@brmur
brmur requested a review from rlhagerm October 15, 2026 10:41
@brmur brmur added the On Call Review needed This work needs an on-call review label Oct 15, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 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

  1. [nit] Prior item (trailing newline) — ADDRESSED. The new file ends with .DS_Store followed by a newline, so this is resolved.

  2. [nit] Prior item (!gradle/wrapper/gradle-wrapper.jar no-op) — still present. Line 3 of the new file negates gradle/wrapper/gradle-wrapper.jar, but no *.jar ignore rule precedes it in this file. The negation is therefore a no-op. It is harmless but misleading. Consider either adding a *.jar rule before it or removing the negation if it is not needed.

  3. [nit] Prior item (.gradle vs .gradle/) — still present. Line 1 uses .gradle (matches both a file and a directory named .gradle) rather than .gradle/ (directory only). Since .gradle is always a directory in Gradle projects, .gradle/ is more precise. This is a cosmetic nit.

  4. [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 .gitignore files (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.

  5. [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/**/build and !**/test/**/build patterns. For a standard single-module Gradle project this is fine, but it would miss src/integrationTest/ or other non-standard source sets. This is a minor behavioral difference unlikely to matter in practice.

  6. [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.

  7. [nit] The /dist/ entry under ### NetBeans ### could theoretically conflict with legitimate dist/ output directories in a Kotlin/Gradle project (though none exist in this service today). This is a low-risk observation.

  8. Overall, the core fix is correct and well-motivated: the /local pattern 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.

Comment thread kotlin/services/bedrock/.gitignore
Comment thread kotlin/services/bedrock/.gitignore
@rlhagerm rlhagerm added On Call Review complete On call review complete and removed On Call Review needed This work needs an on-call review labels Oct 15, 2026
@rlhagerm
rlhagerm merged commit 07365d6 into awsdocs:main Oct 15, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

On Call Review complete On call review complete Task A general update to the code base for language clarification, missing actions, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants