Skip to content

[templates] make scaffolding output deterministic with stable file or… - #834

Open
aishagbadamosi wants to merge 1 commit into
Nanle-code:masterfrom
aishagbadamosi:master
Open

[templates] make scaffolding output deterministic with stable file or…#834
aishagbadamosi wants to merge 1 commit into
Nanle-code:masterfrom
aishagbadamosi:master

Conversation

@aishagbadamosi

@aishagbadamosi aishagbadamosi commented Aug 26, 2026

Copy link
Copy Markdown

…dering

Sort directory entries alphabetically in copy_template_contents() and switch TemplateContext::sections from HashMap to BTreeMap so that identical inputs always produce byte-identical output regardless of platform or run.

  • collect read_dir entries into a Vec and sort by file name before processing
  • replace HashMap with BTreeMap for deterministic section iteration
  • sort list_custom_templates() output
  • add determinism tests: reproducibility, sorted order, placeholder correctness, error on missing source, error on read-only destination
  • document determinism guarantees in TEMPLATE_MARKETPLACE.md

Closes #685

Description

Sort directory entries alphabetically in copy_template_contents() and switch
TemplateContext::sections from HashMap to BTreeMap so that identical inputs
always produce byte-identical output regardless of platform or run.

  • collect read_dir entries into a Vec and sort by file name before processing
  • replace HashMap with BTreeMap for deterministic section iteration
  • sort list_custom_templates() output
  • add determinism tests: reproducibility, sorted order, placeholder correctness,
    error on missing source, error on read-only destination
  • document determinism guarantees in TEMPLATE_MARKETPLACE.md

Closes #685

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Changes Made

  • Change 1
  • Change 2
  • Change 3

Testing

How has this been tested?

Describe the tests you ran and how to reproduce them.

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Coverage

Describe what scenarios have been tested:

  • Happy path:
  • Edge cases:
  • Error handling:

Code Quality Checklist

  • My code follows the style guidelines of this project (cargo fmt)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings (cargo clippy -- -D warnings)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The CI checks pass (format, clippy, tests)

Breaking Changes

  • This PR introduces breaking changes

If checked, describe the breaking changes and migration path:

Documentation

  • README.md updated
  • DEVELOPER_GUIDE.md updated (if applicable)
  • API_REFERENCE.md updated (if applicable)
  • No documentation changes needed

Screenshots (if applicable)

Add screenshots or GIFs for UI changes.

Additional Context

Add any other context about the PR here.


Note: Make sure all tests pass locally before submitting:

cargo test
cargo fmt --all
cargo clippy -- -D warnings

…dering

Sort directory entries alphabetically in copy_template_contents() and switch
TemplateContext::sections from HashMap to BTreeMap so that identical inputs
always produce byte-identical output regardless of platform or run.

- collect read_dir entries into a Vec and sort by file name before processing
- replace HashMap with BTreeMap for deterministic section iteration
- sort list_custom_templates() output
- add determinism tests: reproducibility, sorted order, placeholder correctness,
  error on missing source, error on read-only destination
- document determinism guarantees in TEMPLATE_MARKETPLACE.md

closes Nanle-code#685
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@aishagbadamosi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[2026 Templates] Make scaffolding output deterministic

1 participant