← Back to issue list

Hooks stanza doesn't match parts and apps

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1877448
Type
issue
State
open
Author
~ted
Labels
—
Created
Updated
Closed
—

Current evaluation

2020 feature request to make the hooks stanza name-keyed like apps (hooks.<name>.trigger/command) instead of keyed by trigger; maintainers agreed on the idea but the trigger/complexity discussion stalled, still unimplemented in current schema.

Suggested action: keep open

Reason: A maintainer (kyrofa) explicitly engaged — "I very much support hooks mirroring apps" — and Sergiusens cited the extension use-case, so the issue is triaged and valid rather than untriaged. However, no design was ever agreed: kyrofa pushed back that "the added complexity of the triggers is worth it" is unproven, and the thread ended 2020-06-20 with no resolution. Current code confirms the request is unimplemented: snapcraft/models/project.py still defines `hooks: dict[str, Hook]` with only command_chain/environment/plugs/passthrough fields — no `name`, `trigger`, or `command` key.

Evaluated by: mr-cal-bot

Impact: 32 Quick Win: 4 Complexity: 72 Confidence: 78 Actionability: 42

Issue body

Working on adding some font hooks for the Inkscape package it was my first time using hooks, and I found it kinda confusing. I think this largely stemmed from the fact that the hooks section works differently than the parts and apps sections. The hooks section is abstractly like this: hooks.$trigger.$parameter Where apps and parts are mostly like this: apps.$name.$parameter I think that the $name attribute is useful for organization and allows for more flexible hooks. For instance I'd suggest what is now: hooks:   configure:     plugs: [ desktop ] Would look more like this: hooks:   update-font-cache:     trigger: [ configure ]     command: update-font-cache.sh     plugs: [ desktop ] This would allow for better organization and documentation of hooks. Of course this would require some translation as snapd expects the original format. But that could be achieved with Snapcraft building a shell script for each trigger calling the appropriate hooks.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 32
Quick Win: 4
Complexity: 72
Confidence: 78
Actionability: 42
keep open 2020 feature request to make the hooks stanza name-keyed like apps (hooks.<name>.trigger/command) instead of keyed by trigger; maintainers agreed on the idea but the trigger/complexity discussion stalled, still unimplemented in current schema.
stealth/space-bunny-alpha
Impact: 42
Quick Win: 7
Complexity: 74
Confidence: 94
Actionability: 68
keep open Named, composable hooks with trigger and command fields remain unimplemented; current Snapcraft still keys hooks by snapd trigger and names executable files after that trigger.
stealth/space-bunny-alpha
Impact: 25
Quick Win: 4
Complexity: 65
Confidence: 91
Actionability: 45
needs triage Proposal to replace trigger-keyed hooks with named entries containing trigger and command; current code still uses snapd trigger keys, and the long-unreviewed request needs maintainer triage.
qwen/qwen3.8-27b
Impact: 15
Quick Win: 5
Staleness: 95
Complexity: 65
Confidence: 75
Support Request: 25
needs triage Feature request proposing a syntax change to the hooks stanza in snapcraft.yaml to use named hooks instead of trigger-based keys, for consistency with parts/apps. Open 6+ years with zero comments, no labels, and no maintainer interaction.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 20
Confidence: 85
Support Request: 10
close stale Feature request proposing a syntax change for Snapcraft's hooks stanza. Submitted over six years ago with zero maintainer interaction or comments, it remains unassessed and inactive.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 70
Confidence: 85
Support Request: 10
close stale Proposal to restructure Snapcraft hooks stanza to use a named attribute with a trigger field, aligning it with parts and apps. Unlabelled, zero comments, inactive for over six years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 70
Confidence: 85
Support Request: 10
close stale Six-year-old design proposal suggesting a YAML schema change for Snapcraft hooks to align with parts/apps. Zero maintainer feedback or discussion. Proposal is obsolete given project evolution.

Update history

Date Change
created

Related work

  • Related To: snapcraft#6379 (confidence 45%)

    Commit bdbf07385 'feat: mediate creation of hooks and gui assets (#6379)' touches extension-driven hook generation, the mechanism the issue's extension use-case depends on, but does not add trigger/name semantics.

  • Related To: snapcraft#3837 (confidence 40%)

    Commit c77e3a07a 'hooks: process generated hooks' is part of the current trigger-keyed hooks pipeline that the proposed format would need to change.

Related issues

No related issues found above the similarity threshold.