fix: respect allowed_prefixes config during import (gt-2z6s)
The buildAllowedPrefixSet function now parses the allowed_prefixes config and includes those prefixes when validating imports. This allows mol-* prefixes to be imported without errors when configured. Config example: bd config set allowed_prefixes "gt-,mol-"
This commit is contained in:
@@ -135,6 +135,7 @@
|
|||||||
{"id":"bd-adoe","title":"Add --hard flag to bd cleanup to permanently cull tombstones before cutoff date","description":"Currently tombstones persist for 30 days before cleanup prunes them. Need an official way to force-cull tombstones earlier than the default TTL, for scenarios like cleaning house after extended absence where resurrection from old clones is not a concern. Proposed: bd cleanup --hard --older-than N to bypass the 30-day tombstone TTL.","status":"tombstone","priority":2,"issue_type":"feature","created_at":"2025-12-16T01:17:31.064914-08:00","updated_at":"2025-12-17T16:11:17.070763-08:00","deleted_at":"2025-12-17T16:11:17.070763-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"feature"}
|
{"id":"bd-adoe","title":"Add --hard flag to bd cleanup to permanently cull tombstones before cutoff date","description":"Currently tombstones persist for 30 days before cleanup prunes them. Need an official way to force-cull tombstones earlier than the default TTL, for scenarios like cleaning house after extended absence where resurrection from old clones is not a concern. Proposed: bd cleanup --hard --older-than N to bypass the 30-day tombstone TTL.","status":"tombstone","priority":2,"issue_type":"feature","created_at":"2025-12-16T01:17:31.064914-08:00","updated_at":"2025-12-17T16:11:17.070763-08:00","deleted_at":"2025-12-17T16:11:17.070763-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"feature"}
|
||||||
{"id":"bd-aec5439f","title":"Update LINTING.md with current baseline","description":"After cleanup, document the remaining acceptable baseline in LINTING.md so we can track regression.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T18:53:10.38679-07:00","updated_at":"2025-12-17T22:58:34.564854-08:00","closed_at":"2025-12-17T22:58:34.564854-08:00","close_reason":"Closed"}
|
{"id":"bd-aec5439f","title":"Update LINTING.md with current baseline","description":"After cleanup, document the remaining acceptable baseline in LINTING.md so we can track regression.","status":"closed","priority":2,"issue_type":"task","created_at":"2025-10-27T18:53:10.38679-07:00","updated_at":"2025-12-17T22:58:34.564854-08:00","closed_at":"2025-12-17T22:58:34.564854-08:00","close_reason":"Closed"}
|
||||||
{"id":"bd-ahot","title":"HANDOFF: Molecule bonding - spawn done, bond next","description":"## Context\n\nContinuing work on bd-o5xe (Molecule bonding epic).\n\n## Completed This Session\n\n- bd-mh4w: Renamed bond to spawn in mol.go\n- bd-rnnr: Added BondRef data model to types.go\n\n## Now Unblocked\n\n1. bd-o91r: Polymorphic bond command [P1]\n2. bd-iw4z: Compound visualization [P2] \n3. bd-iq19: Distill command [P2]\n\n## Key Files\n\n- cmd/bd/mol.go\n- internal/types/types.go\n\n## Next Step\n\nStart with bd-o91r. Run bd show bd-o5xe for context.","status":"closed","priority":1,"issue_type":"message","created_at":"2025-12-21T01:32:13.940757-08:00","updated_at":"2025-12-21T11:24:30.171048-08:00","closed_at":"2025-12-21T11:24:30.171048-08:00","close_reason":"Stale handoff - work completed in later sessions"}
|
{"id":"bd-ahot","title":"HANDOFF: Molecule bonding - spawn done, bond next","description":"## Context\n\nContinuing work on bd-o5xe (Molecule bonding epic).\n\n## Completed This Session\n\n- bd-mh4w: Renamed bond to spawn in mol.go\n- bd-rnnr: Added BondRef data model to types.go\n\n## Now Unblocked\n\n1. bd-o91r: Polymorphic bond command [P1]\n2. bd-iw4z: Compound visualization [P2] \n3. bd-iq19: Distill command [P2]\n\n## Key Files\n\n- cmd/bd/mol.go\n- internal/types/types.go\n\n## Next Step\n\nStart with bd-o91r. Run bd show bd-o5xe for context.","status":"closed","priority":1,"issue_type":"message","created_at":"2025-12-21T01:32:13.940757-08:00","updated_at":"2025-12-21T11:24:30.171048-08:00","closed_at":"2025-12-21T11:24:30.171048-08:00","close_reason":"Stale handoff - work completed in later sessions"}
|
||||||
|
{"id":"bd-air9","title":"bd create --parent allocates colliding child IDs when child_counters not backfilled","description":"GH#728: When explicit child IDs are created (--id bd-test.1) or imported from JSONL, child_counters table isn't updated. Then --parent auto-allocation starts at 1 and collides.\n\nFix approach: Update child_counters when creating issues with explicit hierarchical IDs that match \u003cparent\u003e.\u003cn\u003e pattern.","status":"open","priority":1,"issue_type":"bug","created_at":"2025-12-24T14:27:11.990171-08:00","updated_at":"2025-12-24T14:27:11.990171-08:00"}
|
||||||
{"id":"bd-ajdv","title":"Push release v0.33.2 to remote","description":"Push the commit and tag:\n\n```bash\ngit push \u0026\u0026 git push --tags\n```\n\nVerify on GitHub that the tag appears in releases.","status":"tombstone","priority":1,"issue_type":"task","created_at":"2025-12-21T16:10:13.762058-08:00","updated_at":"2025-12-21T17:29:31.791368-08:00","close_reason":"Already pushed to remote","deleted_at":"2025-12-21T17:29:31.791368-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task","wisp":true}
|
{"id":"bd-ajdv","title":"Push release v0.33.2 to remote","description":"Push the commit and tag:\n\n```bash\ngit push \u0026\u0026 git push --tags\n```\n\nVerify on GitHub that the tag appears in releases.","status":"tombstone","priority":1,"issue_type":"task","created_at":"2025-12-21T16:10:13.762058-08:00","updated_at":"2025-12-21T17:29:31.791368-08:00","close_reason":"Already pushed to remote","deleted_at":"2025-12-21T17:29:31.791368-08:00","deleted_by":"batch delete","delete_reason":"batch delete","original_type":"task","wisp":true}
|
||||||
{"id":"bd-akcq","title":"Design molecule step hooks","description":"Hooks that fire between molecule steps. When a bead in a molecule closes, trigger hook that can spawn agent attention to prompts/requests. This enables reactive orchestration - the molecule drives, hooks respond. Gas Town feature built on Beads data plane.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-12-20T23:52:18.63487-08:00","updated_at":"2025-12-21T17:53:19.284064-08:00","closed_at":"2025-12-21T17:53:19.284064-08:00","close_reason":"Moved to gastown: gt-ne1t","dependencies":[{"issue_id":"bd-akcq","depends_on_id":"bd-icnf","type":"blocks","created_at":"2025-12-20T23:52:25.935274-08:00","created_by":"daemon"}]}
|
{"id":"bd-akcq","title":"Design molecule step hooks","description":"Hooks that fire between molecule steps. When a bead in a molecule closes, trigger hook that can spawn agent attention to prompts/requests. This enables reactive orchestration - the molecule drives, hooks respond. Gas Town feature built on Beads data plane.","status":"closed","priority":2,"issue_type":"feature","created_at":"2025-12-20T23:52:18.63487-08:00","updated_at":"2025-12-21T17:53:19.284064-08:00","closed_at":"2025-12-21T17:53:19.284064-08:00","close_reason":"Moved to gastown: gt-ne1t","dependencies":[{"issue_id":"bd-akcq","depends_on_id":"bd-icnf","type":"blocks","created_at":"2025-12-20T23:52:25.935274-08:00","created_by":"daemon"}]}
|
||||||
{"id":"bd-aks","title":"Add tests for import/export functionality","description":"Import/export functions like ImportIssues, exportToJSONLWithStore, and AutoImportIfNewer have low coverage. These are critical for data integrity and multi-repo synchronization.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-18T07:00:53.067006711-07:00","updated_at":"2025-12-19T09:54:57.011374404-07:00","closed_at":"2025-12-18T10:13:11.821944156-07:00","dependencies":[{"issue_id":"bd-aks","depends_on_id":"bd-6ss","type":"discovered-from","created_at":"2025-12-18T07:00:53.07185201-07:00","created_by":"matt"}]}
|
{"id":"bd-aks","title":"Add tests for import/export functionality","description":"Import/export functions like ImportIssues, exportToJSONLWithStore, and AutoImportIfNewer have low coverage. These are critical for data integrity and multi-repo synchronization.","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-18T07:00:53.067006711-07:00","updated_at":"2025-12-19T09:54:57.011374404-07:00","closed_at":"2025-12-18T10:13:11.821944156-07:00","dependencies":[{"issue_id":"bd-aks","depends_on_id":"bd-6ss","type":"discovered-from","created_at":"2025-12-18T07:00:53.07185201-07:00","created_by":"matt"}]}
|
||||||
|
|||||||
@@ -216,8 +216,11 @@ func handlePrefixMismatch(ctx context.Context, sqliteStore *sqlite.SQLiteStorage
|
|||||||
|
|
||||||
result.ExpectedPrefix = configuredPrefix
|
result.ExpectedPrefix = configuredPrefix
|
||||||
|
|
||||||
|
// gt-2z6s: Read allowed_prefixes config for additional valid prefixes (e.g., mol-*)
|
||||||
|
allowedPrefixesConfig, _ := sqliteStore.GetConfig(ctx, "allowed_prefixes")
|
||||||
|
|
||||||
// GH#686: In multi-repo mode, allow all prefixes (nil = allow all)
|
// GH#686: In multi-repo mode, allow all prefixes (nil = allow all)
|
||||||
allowedPrefixes := buildAllowedPrefixSet(configuredPrefix)
|
allowedPrefixes := buildAllowedPrefixSet(configuredPrefix, allowedPrefixesConfig)
|
||||||
if allowedPrefixes == nil {
|
if allowedPrefixes == nil {
|
||||||
return issues, nil
|
return issues, nil
|
||||||
}
|
}
|
||||||
@@ -235,7 +238,14 @@ func handlePrefixMismatch(ctx context.Context, sqliteStore *sqlite.SQLiteStorage
|
|||||||
// GH#422: Check if issue ID starts with configured prefix directly
|
// GH#422: Check if issue ID starts with configured prefix directly
|
||||||
// rather than extracting/guessing. This handles multi-hyphen prefixes
|
// rather than extracting/guessing. This handles multi-hyphen prefixes
|
||||||
// like "asianops-audit-" correctly.
|
// like "asianops-audit-" correctly.
|
||||||
prefixMatches := strings.HasPrefix(issue.ID, configuredPrefix+"-")
|
// gt-2z6s: Also check against allowed_prefixes config
|
||||||
|
prefixMatches := false
|
||||||
|
for prefix := range allowedPrefixes {
|
||||||
|
if strings.HasPrefix(issue.ID, prefix+"-") {
|
||||||
|
prefixMatches = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
if !prefixMatches {
|
if !prefixMatches {
|
||||||
// Extract prefix for error reporting (best effort)
|
// Extract prefix for error reporting (best effort)
|
||||||
prefix := utils.ExtractIssuePrefix(issue.ID)
|
prefix := utils.ExtractIssuePrefix(issue.ID)
|
||||||
@@ -970,9 +980,26 @@ func validateNoDuplicateExternalRefs(issues []*types.Issue, clearDuplicates bool
|
|||||||
|
|
||||||
// buildAllowedPrefixSet returns allowed prefixes, or nil to allow all (GH#686).
|
// buildAllowedPrefixSet returns allowed prefixes, or nil to allow all (GH#686).
|
||||||
// In multi-repo mode, additional repos have their own prefixes - allow all.
|
// In multi-repo mode, additional repos have their own prefixes - allow all.
|
||||||
func buildAllowedPrefixSet(primaryPrefix string) map[string]bool {
|
// gt-2z6s: Also accepts allowedPrefixesConfig (comma-separated list like "gt-,mol-").
|
||||||
|
func buildAllowedPrefixSet(primaryPrefix string, allowedPrefixesConfig string) map[string]bool {
|
||||||
if config.GetMultiRepoConfig() != nil {
|
if config.GetMultiRepoConfig() != nil {
|
||||||
return nil // Multi-repo: allow all prefixes
|
return nil // Multi-repo: allow all prefixes
|
||||||
}
|
}
|
||||||
return map[string]bool{primaryPrefix: true}
|
|
||||||
|
allowed := map[string]bool{primaryPrefix: true}
|
||||||
|
|
||||||
|
// gt-2z6s: Parse allowed_prefixes config (comma-separated, with or without trailing -)
|
||||||
|
if allowedPrefixesConfig != "" {
|
||||||
|
for _, prefix := range strings.Split(allowedPrefixesConfig, ",") {
|
||||||
|
prefix = strings.TrimSpace(prefix)
|
||||||
|
if prefix == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// Normalize: remove trailing - if present (we match without it)
|
||||||
|
prefix = strings.TrimSuffix(prefix, "-")
|
||||||
|
allowed[prefix] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return allowed
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user