Skip to content

feat: deprecation warning for snap_daemon system username - #6250

Draft
lengau wants to merge 1 commit into
mainfrom
work/fix-5448
Draft

feat: deprecation warning for snap_daemon system username#6250
lengau wants to merge 1 commit into
mainfrom
work/fix-5448

Conversation

@lengau

@lengau lengau commented May 15, 2026

Copy link
Copy Markdown
Contributor

Add a SystemUsernames pydantic model with snap_daemon marked as deprecated, so the JSON schema exposes 'deprecated: true' on that key. Also emit a runtime warning via craft-cli when snap_daemon is used.

Fixes: #5448

Describe your changes.


  • I've followed the contribution guidelines.
  • I've signed the CLA.
  • I've successfully run make lint && make test.
  • I've added or updated any relevant documentation.
  • In documents I changed, I added a meta description if one was missing.
  • I've updated the relevant release notes.

Add a SystemUsernames pydantic model with snap_daemon marked as
deprecated, so the JSON schema exposes 'deprecated: true' on that key.
Also emit a runtime warning via craft-cli when snap_daemon is used.

Fixes: #5448

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI 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.

Pull request overview

This PR adds explicit deprecation signaling for the snap_daemon entry under system-usernames, both in the runtime (via craft-cli warnings) and in the generated snapcraft.yaml JSON schema (via a dedicated pydantic model field marked deprecated), aligning Snapcraft with snapd’s deprecation of that username.

Changes:

  • Introduces a SystemUsernames pydantic model with snap_daemon marked deprecated and updates Project.system_usernames to use it.
  • Emits a runtime warning when system-usernames.snap_daemon is present during project unmarshalling.
  • Updates snap.yaml metadata generation to serialize the new SystemUsernames model back into a plain dict, and adds/adjusts unit tests for the warning behavior.

Reviewed changes

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

File Description
snapcraft/models/project.py Adds SystemUsernames, switches Project.system_usernames to that model, and warns at runtime when snap_daemon is used.
snapcraft/meta/snap_yaml.py Converts SystemUsernames back to a dict for snap.yaml generation via model_dump().
tests/unit/models/test_projects.py Updates system usernames assertions for model-based storage and adds warning/no-warning coverage.

Comment on lines +1268 to +1277
snap_daemon: Annotated[
str | dict[str, Any] | None,
pydantic.Field(
default=None,
deprecated=(
"The 'snap_daemon' system username is deprecated. "
"See https://snapcraft.io/docs/system-usernames."
),
),
] = None
Comment on lines +1268 to +1276
snap_daemon: Annotated[
str | dict[str, Any] | None,
pydantic.Field(
default=None,
deprecated=(
"The 'snap_daemon' system username is deprecated. "
"See https://snapcraft.io/docs/system-usernames."
),
),
Comment on lines +1980 to +1981
cls, system_usernames: SystemUsernames
) -> SystemUsernames:
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.

Add deprecation warning for the snap_daemon system username

2 participants