Skip to content

refactor: replace hand-rolled membership and index helpers with slices.* - #1497

Open
devin-ai-integration[bot] wants to merge 2 commits into
developfrom
refactor/slices-contains-helpers
Open

devin-ai-integration[bot] wants to merge 2 commits into
developfrom
refactor/slices-contains-helpers

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

What and why

The migrator, runtime, solver, analysis framework, document planner, API JSON writer, semantics package and the tools module each carried their own ==-loop membership or index helper (contains, containsElement, containsSymbol, containsFit, containsInstance, containsFeatureValue, indexOfSymbol, joins, containsColumn, indexOfAPIJSONProperty, containsInt, containsString, Query.declares, containsWord, appendUnique, lastName) that duplicate slices.Contains, slices.ContainsFunc and slices.Index from the standard library, which the module already uses widely. This PR deletes the helpers and calls slices.* directly at every call site; tools/census/metaclassmap/analyze.go spells the last segment of a qualified name through the existing symbols.LastSegment instead of its own lastName. indicesWithFit in internal/semantic/semantics/invocation.go stays because it still has other callers.

Pure refactor, no behaviour change: every replacement keeps the same equality, first-match, empty-slice and -1-for-absent semantics. Test-only callers (members_test.go, robustness_extent_model_determined_test.go) now call slices.* directly; no test was removed or weakened.

Editing internal/translate/export/api_json_out.go moves the API JSON writer's source digest, so docs/project/api-json-differential-baseline.json is re-recorded with go run -C tools ./cmd/pilot-apijson-diff -update: only provenance.tools[api-json-writer].sourceDigest and recorded changed; every measured figure is identical.

How it was verified

go build ./...                      ok
go vet ./...                        ok
gofmt -l .                          (no output)
go test -count=1 -timeout 45m ./... ok (all packages)
cd tools && go build ./... && go vet ./... && gofmt -l . && go test -count=1 ./...   ok

The tools suite was run after re-recording the baseline (the tools/referee/apijson provenance test fails deliberately when internal/translate/export changes without a re-record).

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change (existing tests cover every call site; test-only callers repointed)
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/slices-contains-helpers.changed.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (only the API JSON baseline's provenance moved; no count changed)
  • No internal work-item labels in the body, docs, or changelog

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/d47554ed93494ba4a374cbe22108a0cb
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/d47554ed93494ba4a374cbe22108a0cb?variant=devin
Requested by: @HuiJun

devin-ai-integration Bot and others added 2 commits October 25, 2026 02:55
Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 25, 2026 05:22

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch has not been deployed

No deployments
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.

1 participant