-
-
Notifications
You must be signed in to change notification settings - Fork 18
Wire up ADS submodule, codegen, runtime path aliases (no behavioral swap yet) #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c3d7008
4d0fcca
9a65f7a
50804ee
b6c7b83
36c629c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||||||||||||||||||||||||||||
| name: ADS check | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||
| branches: [master, dsl/adopt-v1] | ||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||
| ads-generated-up-to-date: | ||||||||||||||||||||||||||||||||||
| uses: airframesio/acars-decoder/.github/workflows/codegen-check.yml@init/ads-v1 | ||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+12
|
||||||||||||||||||||||||||||||||||
| language: ts | ||||||||||||||||||||||||||||||||||
| generated-path: lib/plugins/generated | ||||||||||||||||||||||||||||||||||
| spec-path: vendor/airframes-decoder/spec | ||||||||||||||||||||||||||||||||||
| codegen-path: vendor/airframes-decoder/codegen | ||||||||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+16
Comment on lines
+10
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an explicit The workflow inherits default 🛡️ Proposed fix to add minimal permissions jobs:
ads-generated-up-to-date:
+ permissions:
+ contents: read
uses: airframesio/acars-decoder/.github/workflows/codegen-check.yml@init/ads-v1Adjust permissions based on what the reusable workflow actually requires. If it only validates generated code, 📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: CodeQL[warning] 11-16: Workflow does not contain permissions 🪛 zizmor (1.25.2)[warning] 10-17: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [error] 11-11: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "vendor/airframes-decoder"] | ||
| path = vendor/airframes-decoder | ||
| url = https://github.com/airframesio/acars-decoder.git |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -88,7 +88,14 @@ export default { | |||||||||||||||||||||||||||||||||
| // ], | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module | ||||||||||||||||||||||||||||||||||
| // moduleNameMapper: {}, | ||||||||||||||||||||||||||||||||||
| moduleNameMapper: { | ||||||||||||||||||||||||||||||||||
| "^@airframes/ads-runtime-ts$": | ||||||||||||||||||||||||||||||||||
| "<rootDir>/vendor/airframes-decoder/runtimes/typescript/index.ts", | ||||||||||||||||||||||||||||||||||
| "^@airframes/ads-runtime-ts/helpers$": | ||||||||||||||||||||||||||||||||||
| "<rootDir>/vendor/airframes-decoder/runtimes/typescript/helpers.ts", | ||||||||||||||||||||||||||||||||||
| "^@airframes/ads-runtime-ts/escape_hatches$": | ||||||||||||||||||||||||||||||||||
| "<rootDir>/vendor/airframes-decoder/runtimes/typescript/escape_hatches/index.ts", | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+91
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix quote style to match Prettier configuration. All string literals in 🎨 Proposed fix moduleNameMapper: {
- "^`@airframes/ads-runtime-ts`$":
- "<rootDir>/vendor/airframes-decoder/runtimes/typescript/index.ts",
- "^`@airframes/ads-runtime-ts/helpers`$":
- "<rootDir>/vendor/airframes-decoder/runtimes/typescript/helpers.ts",
- "^`@airframes/ads-runtime-ts/escape_hatches`$":
- "<rootDir>/vendor/airframes-decoder/runtimes/typescript/escape_hatches/index.ts",
+ '^`@airframes/ads-runtime-ts`$':
+ '<rootDir>/vendor/airframes-decoder/runtimes/typescript/index.ts',
+ '^`@airframes/ads-runtime-ts/helpers`$':
+ '<rootDir>/vendor/airframes-decoder/runtimes/typescript/helpers.ts',
+ '^`@airframes/ads-runtime-ts/escape_hatches`$':
+ '<rootDir>/vendor/airframes-decoder/runtimes/typescript/escape_hatches/index.ts',
},📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 92-92: Replace (prettier/prettier) [error] 93-93: Replace (prettier/prettier) [error] 94-94: Replace (prettier/prettier) [error] 95-95: Replace (prettier/prettier) [error] 96-96: Replace (prettier/prettier) [error] 97-97: Replace (prettier/prettier) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader | ||||||||||||||||||||||||||||||||||
| // modulePathIgnorePatterns: [], | ||||||||||||||||||||||||||||||||||
|
|
@@ -159,9 +166,10 @@ export default { | |||||||||||||||||||||||||||||||||
| // ], | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped | ||||||||||||||||||||||||||||||||||
| // testPathIgnorePatterns: [ | ||||||||||||||||||||||||||||||||||
| // "/node_modules/" | ||||||||||||||||||||||||||||||||||
| // ], | ||||||||||||||||||||||||||||||||||
| testPathIgnorePatterns: [ | ||||||||||||||||||||||||||||||||||
| "/node_modules/", | ||||||||||||||||||||||||||||||||||
| "/vendor/", // skip vendored airframes-decoder submodule's tests | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+169
to
+172
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix quote style to match Prettier configuration. The string literals use double quotes, but Prettier is configured to enforce single quotes. This will cause the build to fail or require a formatting pass. 🎨 Proposed fix testPathIgnorePatterns: [
- "/node_modules/",
- "/vendor/", // skip vendored airframes-decoder submodule's tests
+ '/node_modules/',
+ '/vendor/', // skip vendored airframes-decoder submodule's tests
],📝 Committable suggestion
Suggested change
🧰 Tools🪛 ESLint[error] 163-163: Replace (prettier/prettier) [error] 164-164: Replace (prettier/prettier) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // The regexp pattern or array of patterns that Jest uses to detect test files | ||||||||||||||||||||||||||||||||||
| // testRegex: [], | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| import type { | ||
| DecodeResult, | ||
| DecoderPlugin, | ||
| Message, | ||
| Options, | ||
| } from '@airframes/ads-runtime-ts'; | ||
| import { ResultFormatter } from '@airframes/ads-runtime-ts'; | ||
| import { Arinc702Helper } from '../../utils/arinc_702_helper'; | ||
|
|
||
| /** | ||
| * Whole-plugin parse hatch for ARINC_702 (ARINC 702 Message). | ||
| * | ||
| * Tries Arinc702Helper.decodeH1Message on, in order: | ||
| * 1. the raw (CR/LF stripped) text; | ||
| * 2. when the text starts with '/', the body after the first '.'; | ||
| * 3. when split by '#' gives exactly two parts, the chunk after a | ||
| * heuristic offset (3 or 4 depending on preceding context), | ||
| * pulling the flight number from the leading chunk and rebuilding | ||
| * remaining.text in original order; | ||
| * 4. when split by '/' has a leading chunk > 3 chars, the slice | ||
| * starting 3 chars before the '/', with the leading 3 chars + | ||
| * '/' restored at the front of remaining.text. | ||
| * | ||
| * processDecodeResult finalizes the decoded flag and decodeLevel; if no | ||
| * items were emitted, falls back to unknown with debug logging. | ||
| */ | ||
| export function arinc_702_dispatch( | ||
| _plugin: DecoderPlugin, | ||
| message: Message, | ||
| result: DecodeResult, | ||
| options: Options, | ||
| ): DecodeResult { | ||
| const msg = message.text.replace(/\n|\r/g, ''); | ||
|
|
||
| let decoded = false; | ||
| decoded = Arinc702Helper.decodeH1Message(result, msg); | ||
| if (decoded) { | ||
| return processDecodeResult(result, decoded, options, message); | ||
| } | ||
|
|
||
| if (msg.startsWith('/')) { | ||
| const headerData = msg.split('.'); | ||
| decoded = Arinc702Helper.decodeH1Message( | ||
| result, | ||
| headerData.slice(1).join('.'), | ||
| ); | ||
|
|
||
| if (decoded) { | ||
| result.remaining.text = | ||
| headerData[0] + '.' + result.remaining.text; | ||
| return processDecodeResult(result, decoded, options, message); | ||
| } | ||
| } | ||
|
|
||
| const hashParts = msg.split('#'); | ||
| if (hashParts.length === 2) { | ||
| const offset = | ||
| hashParts[0] === '- ' || isNaN(parseInt(hashParts[1][1])) ? 3 : 4; | ||
| decoded = Arinc702Helper.decodeH1Message( | ||
| result, | ||
| msg.slice(hashParts[0].length + offset), | ||
| ); | ||
| if (decoded && hashParts[0].length > 0) { | ||
| ResultFormatter.flightNumber(result, hashParts[0].substring(4)); | ||
| result.remaining.text = | ||
| hashParts[0].substring(0, 4) + | ||
| '#' + | ||
| hashParts[1].substring(0, offset - 1) + | ||
| '/' + | ||
| result.remaining.text; | ||
| } | ||
| if (decoded) { | ||
| return processDecodeResult(result, decoded, options, message); | ||
| } | ||
| } | ||
|
|
||
| const slashParts = msg.split('/'); | ||
| if (slashParts[0].length > 3) { | ||
| decoded = Arinc702Helper.decodeH1Message( | ||
| result, | ||
| msg.slice(slashParts[0].length - 3), | ||
| ); | ||
| result.remaining.text = | ||
| slashParts[0].slice(0, 3) + '/' + result.remaining.text; | ||
| } | ||
|
|
||
| return processDecodeResult(result, decoded, options, message); | ||
| } | ||
|
|
||
| function processDecodeResult( | ||
| result: DecodeResult, | ||
| decoded: boolean, | ||
| options: Options, | ||
| message: Message, | ||
| ): DecodeResult { | ||
| result.decoded = decoded; | ||
| result.decoder.decodeLevel = !result.remaining.text ? 'full' : 'partial'; | ||
| if (result.formatted.items.length === 0) { | ||
| if (options.debug) { | ||
| console.log(`Decoder: Unknown H1 message: ${message.text}`); | ||
| } | ||
| ResultFormatter.unknown(result, message.text); | ||
| result.decoded = false; | ||
| result.decoder.decodeLevel = 'none'; | ||
| } | ||
| return result; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: airframesio/acars-decoder-typescript
Length of output: 121
🏁 Script executed:
Repository: airframesio/acars-decoder-typescript
Length of output: 179
🏁 Script executed:
Repository: airframesio/acars-decoder-typescript
Length of output: 1299
🏁 Script executed:
Repository: airframesio/acars-decoder-typescript
Length of output: 605
Pin the reusable workflow to a commit SHA.
.github/workflows/ads-check.yml(jobads-generated-up-to-date) currently callscodegen-check.ymlvia a branch ref (@init/ads-v1), which is a supply-chain risk. Pin it to the current commit for that ref:Also add an explicit
permissions:block (workflow- or job-level) to scopeGITHUB_TOKENto the minimum required; this workflow currently has nopermissions:configured.🧰 Tools
🪛 GitHub Check: CodeQL
[warning] 11-16: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{}}
🪛 zizmor (1.25.2)
[error] 11-11: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents