Skip to content

feat(render): add --allow-dirty flag for uncommitted lock state#181

Open
dmcilvaney wants to merge 5 commits into
microsoft:mainfrom
dmcilvaney:damcilva/allow-dirty
Open

feat(render): add --allow-dirty flag for uncommitted lock state#181
dmcilvaney wants to merge 5 commits into
microsoft:mainfrom
dmcilvaney:damcilva/allow-dirty

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

Add --allow-dirty to build, render, and prepare-sources commands to
control how uncommitted lock file changes are handled during synthetic
history generation.

When --allow-dirty is set, uncommitted lock data is used as a fallback
when no committed lock exists at HEAD, and fingerprint mismatches
produce dirty synthetic entries. When unset, uncommitted state produces
errors with hints suggesting --allow-dirty.

  • Add allowDirty + hints plumbing through buildSyntheticCommits
  • Extract handleMissingHeadLock and handleDirtyState helpers
  • Add Hints() to SourcePreparer interface for caller-facing suggestions
  • Always compute fingerprints (local I/O only, no network)
  • Add WithPreScript option to scenario ProjectTest
  • Scenario build test commits locks before building
  • Regenerate CLI docs

Copilot AI review requested due to automatic review settings May 12, 2026 21:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an --allow-dirty (-d) flag to component build, render, and prepare-sources to control whether uncommitted lock-file state (and fingerprint mismatches vs HEAD) can be used during synthetic history generation.

Changes:

  • Add --allow-dirty to build/render/prepare-sources and plumb it into synthetic history creation.
  • Extend synthetic history generation to (optionally) fall back to on-disk lock state when no committed lock exists at HEAD, and to return caller-facing “hints”.
  • Scenario harness updates to support running pre-script lines and committing locks during scenario build tests; regenerate CLI docs.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
scenario/internal/projecttest/projecttest.go Adds WithPreScript support to run raw shell lines before the main scenario command.
scenario/component_build_test.go Commits generated locks before building so synthetic history can read committed lock state.
internal/app/azldev/core/sources/synthistory.go Implements allowDirty/hint plumbing, missing-HEAD-lock handling, and dirty-state handling for synthetic history.
internal/app/azldev/core/sources/synthistory_internal_test.go Adds unit tests for the new synthetic-history helper behaviors.
internal/app/azldev/core/sources/sourceprep.go Adds Hints() to SourcePreparer and threads hint collection into synthetic history preparation.
internal/app/azldev/cmds/component/render.go Adds --allow-dirty flag, passes it into preparation, and attempts to surface preparer hints.
internal/app/azldev/cmds/component/preparesources.go Adds --allow-dirty flag and gates dirty detection accordingly.
internal/app/azldev/cmds/component/build.go Adds --allow-dirty flag and gates dirty detection accordingly.
docs/user/reference/cli/azldev_component_render.md Regenerated CLI docs reflecting --allow-dirty.
docs/user/reference/cli/azldev_component_prepare-sources.md Regenerated CLI docs reflecting --allow-dirty.
docs/user/reference/cli/azldev_component_build.md Regenerated CLI docs reflecting --allow-dirty.
Comments suppressed due to low confidence (1)

internal/app/azldev/core/sources/synthistory.go:711

  • This hint also says "to render" even though the synthetic-history code is used by multiple commands. Please make the hint command-agnostic (or mention all relevant commands) so users running build/prepare-sources aren't confused.
		*hints = append(*hints,
			"use '--allow-dirty' ('-d') to render with uncommitted lock files")

Comment thread internal/app/azldev/core/sources/synthistory.go
Comment thread internal/app/azldev/core/sources/synthistory.go Outdated
Comment thread internal/app/azldev/core/sources/sourceprep.go
Comment thread internal/app/azldev/core/sources/sourceprep.go
Comment thread internal/app/azldev/cmds/component/render.go
Comment thread internal/app/azldev/cmds/component/build.go
Comment thread internal/app/azldev/cmds/component/preparesources.go
Comment thread internal/app/azldev/cmds/component/render.go Outdated
@dmcilvaney dmcilvaney force-pushed the damcilva/allow-dirty branch from dc9d162 to 49c12ae Compare May 12, 2026 23:05
Copilot AI review requested due to automatic review settings May 13, 2026 00:07
@dmcilvaney dmcilvaney force-pushed the damcilva/allow-dirty branch from 924394d to 169bb59 Compare May 13, 2026 00:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread internal/app/azldev/cmds/component/render.go
Comment thread internal/app/azldev/cmds/component/render.go Outdated
Comment thread internal/app/azldev/cmds/component/preparesources.go Outdated
Comment thread internal/app/azldev/cmds/component/build.go Outdated
@dmcilvaney dmcilvaney force-pushed the damcilva/allow-dirty branch from 169bb59 to ad4fc7b Compare May 13, 2026 18:31
Copilot AI review requested due to automatic review settings May 13, 2026 18:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Comment thread internal/app/azldev/core/sources/synthistory.go Outdated
Comment thread internal/app/azldev/cmds/component/render.go
Comment thread scenario/component_build_test.go
Comment thread internal/app/azldev/core/sources/synthistory_internal_test.go Outdated
Comment thread internal/app/azldev/core/sources/sourceprep.go Outdated
Comment thread internal/app/azldev/core/sources/synthistory.go Outdated
@dmcilvaney dmcilvaney marked this pull request as ready for review May 13, 2026 21:55
Add --allow-dirty to build, render, and prepare-sources commands to
control how uncommitted lock file changes are handled during synthetic
history generation.

When --allow-dirty is set, uncommitted lock data is used as a fallback
when no committed lock exists at HEAD, and fingerprint mismatches
produce dirty synthetic entries. When unset, uncommitted state produces
errors with hints suggesting --allow-dirty.

- Add allowDirty + hints plumbing through buildSyntheticCommits
- Extract handleMissingHeadLock and handleDirtyState helpers
- Add Hints() to SourcePreparer interface for caller-facing suggestions
- Always compute fingerprints (local I/O only, no network)
- Add WithPreScript option to scenario ProjectTest
- Scenario build test commits locks before building
- Regenerate CLI docs
Copilot AI review requested due to automatic review settings May 13, 2026 23:54
@dmcilvaney dmcilvaney force-pushed the damcilva/allow-dirty branch from 73ef837 to 54b8bf1 Compare May 13, 2026 23:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Comment thread internal/app/azldev/cmds/component/render.go
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.

2 participants